From 2395c0b0ca81c2a062392687634dd3e5a4872563 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Wed, 1 Feb 2023 02:59:04 -0500 Subject: [PATCH] chore: lint/warnings --- .../transformers/add_search_structure.ex | 4 ++-- .../docs/flows/search/steps/build_results.ex | 19 ------------------- lib/ash_hq_web/components/search.ex | 2 +- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex b/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex index a5b0d15..3936587 100644 --- a/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex +++ b/lib/ash_hq/docs/extensions/search/transformers/add_search_structure.ex @@ -45,7 +45,7 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do :searchable | currently_ignored_attributes ]) |> add_search_headline_calculation(config) - |> add_matches_calculation(config) + |> add_matches_calculation() |> add_full_text_column(config) |> add_full_text_index() |> add_match_rank_calculation(config) @@ -232,7 +232,7 @@ defmodule AshHq.Docs.Extensions.Search.Transformers.AddSearchStructure do ) end - defp add_matches_calculation(dsl_state, config) do + defp add_matches_calculation(dsl_state) do Transformer.add_entity( dsl_state, [:calculations], diff --git a/lib/ash_hq/docs/flows/search/steps/build_results.ex b/lib/ash_hq/docs/flows/search/steps/build_results.ex index d60264d..1fc2d07 100644 --- a/lib/ash_hq/docs/flows/search/steps/build_results.ex +++ b/lib/ash_hq/docs/flows/search/steps/build_results.ex @@ -32,23 +32,4 @@ defmodule AshHq.Docs.Search.Steps.BuildResults do false end end - - # defp name_match_rank(%resource{} = record) do - # if AshHq.Docs.Extensions.Search.has_name_attribute?(resource) && - # record.name_matches do - # -(100_000 - search_length(record)) - # else - # 0 - # end - # end - - defp search_length(%resource{} = record) do - case AshHq.Docs.Extensions.Search.name_attribute(resource) do - nil -> - 0 - - doc_attribute -> - String.length(Map.get(record, doc_attribute)) - end - end end diff --git a/lib/ash_hq_web/components/search.ex b/lib/ash_hq_web/components/search.ex index 4a3382b..4297438 100644 --- a/lib/ash_hq_web/components/search.ex +++ b/lib/ash_hq_web/components/search.ex @@ -4,7 +4,7 @@ defmodule AshHqWeb.Components.Search do require Ash.Query - alias AshHqWeb.Components.{CalloutText, Catalogue} + alias AshHqWeb.Components.Catalogue alias AshHqWeb.DocRoutes alias Phoenix.LiveView.JS alias Surface.Components.{Form, LivePatch}