From f522f93a1283610a9a01772186bba1e93c9a1cb8 Mon Sep 17 00:00:00 2001 From: Javier Toledo Date: Tue, 2 Jul 2024 21:18:03 +0100 Subject: [PATCH] Added a test for an error scenario --- test/multi_search_test.exs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/multi_search_test.exs b/test/multi_search_test.exs index 15b216a..c1d5410 100644 --- a/test/multi_search_test.exs +++ b/test/multi_search_test.exs @@ -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