diff --git a/core/lib/canary/index/index.ex b/core/lib/canary/index/index.ex index 83f151f8..8dae11a0 100644 --- a/core/lib/canary/index/index.ex +++ b/core/lib/canary/index/index.ex @@ -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 diff --git a/core/lib/canary/searcher.ex b/core/lib/canary/searcher.ex index 379c7146..e98a91be 100644 --- a/core/lib/canary/searcher.ex +++ b/core/lib/canary/searcher.ex @@ -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