Skip to content

Commit

Permalink
Added a test for an error scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
javiertoledo committed Jul 2, 2024
1 parent 27a7b72 commit f522f93
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/multi_search_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,18 @@ defmodule MultisearchTest do
assert [%{"found" => 1, "hits" => hits} | _rest] = results
assert [%{"document" => %{"company_name" => "Test"}, "vector_distance" => _some_number} | _rest] = hits
end

test "error: multi_search with vector_search by an id that doesn't exist", %{conn: conn, schema: schema} do
searches = [
%{
collection: schema.name,
q: "*",
vector_query: "company_description_embedding:([], id:1)",
exclude_fields: "company_description_embedding"
}
]

# Errors are returned per-search and must be extracted separately
assert {:ok, %{"results" => [%{"error" => _} | _]}} = ExTypesense.multi_search(conn, searches)
end
end

0 comments on commit f522f93

Please sign in to comment.