Skip to content

Commit

Permalink
small fix in searcher
Browse files Browse the repository at this point in the history
  • Loading branch information
yujonglee committed Sep 28, 2024
1 parent 7bb575a commit a76fe97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion core/lib/canary/index/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ defmodule Canary.Index do
Client.delete_document(source_type, id)
end

def search(sources, queries, opts \\ []) when is_list(queries) do
def search(_, _, _ \\ [])
def search([], _, _), do: {:ok, []}

def search(sources, queries, opts) when is_list(queries) do
args = build_args(sources, queries, opts)

case Canary.Index.Client.multi_search(args) do
Expand Down
4 changes: 1 addition & 3 deletions core/lib/canary/searcher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ defmodule Canary.Searcher.Default do
end

defp ai?(query) do
query
|> String.split(" ", trim: true)
|> Enum.count() > 2
String.ends_with?(query, "?") or String.split(query, " ", trim: true) |> Enum.count() > 2
end

defp ai_search(sources, query) do
Expand Down

0 comments on commit a76fe97

Please sign in to comment.