diff --git a/tests/test_data/search_responses/empty_search_response.json b/tests/test_data/search_responses/empty_search_response.json index 188cf189..8bbaaf7a 100644 --- a/tests/test_data/search_responses/empty_search_response.json +++ b/tests/test_data/search_responses/empty_search_response.json @@ -19,6 +19,9 @@ "relevance": 1.0, "continuation": { "this": "" + }, + "fields": { + "count()": 0 } } ] diff --git a/tests/test_data/search_responses/search_response.json b/tests/test_data/search_responses/search_response.json index 7c1c63f8..3f6f0d03 100644 --- a/tests/test_data/search_responses/search_response.json +++ b/tests/test_data/search_responses/search_response.json @@ -20,6 +20,9 @@ "continuation": { "next": "BGAAABECBEBC" }, + "fields": { + "count()": 18 + }, "children": [ { "id": "grouplist:family_import_id", @@ -33,6 +36,9 @@ "id": "group:string:UNFCCC.family.1062.0", "relevance": 9.850756434359045, "value": "UNFCCC.family.1062.0", + "fields": { + "count()": 451 + }, "children": [ { "id": "hitlist:hits", @@ -510,6 +516,9 @@ "id": "group:string:CCLW.family.11127.0", "relevance": 9.68513590994337, "value": "CCLW.family.11127.0", + "fields": { + "count()": 251 + }, "children": [ { "id": "hitlist:hits", @@ -662,6 +671,9 @@ "id": "group:string:CCLW.family.9095.0", "relevance": 9.671909754163924, "value": "CCLW.family.9095.0", + "fields": { + "count()": 151 + }, "children": [ { "id": "hitlist:hits", @@ -1139,6 +1151,9 @@ "id": "group:string:UNFCCC.family.1018.0", "relevance": 9.560969759511618, "value": "UNFCCC.family.1018.0", + "fields": { + "count()": 71 + }, "children": [ { "id": "hitlist:hits", @@ -1475,6 +1490,9 @@ "id": "group:string:UNFCCC.family.1006.0", "relevance": 9.289557554521354, "value": "UNFCCC.family.1006.0", + "fields": { + "count()": 47 + }, "children": [ { "id": "hitlist:hits", @@ -1952,6 +1970,9 @@ "id": "group:string:UNFCCC.family.1024.0", "relevance": 9.289557554521354, "value": "UNFCCC.family.1024.0", + "fields": { + "count()": 44 + }, "children": [ { "id": "hitlist:hits", @@ -2429,6 +2450,9 @@ "id": "group:string:UNFCCC.family.1010.0", "relevance": 9.24455139928541, "value": "UNFCCC.family.1010.0", + "fields": { + "count()": 38 + }, "children": [ { "id": "hitlist:hits", @@ -2906,6 +2930,9 @@ "id": "group:string:CCLW.family.11106.0", "relevance": 9.2028711390936, "value": "CCLW.family.11106.0", + "fields": { + "count()": 29 + }, "children": [ { "id": "hitlist:hits", @@ -3383,6 +3410,9 @@ "id": "group:string:CCLW.family.9101.0", "relevance": 9.182188646184347, "value": "CCLW.family.9101.0", + "fields": { + "count()": 24 + }, "children": [ { "id": "hitlist:hits", @@ -3860,6 +3890,9 @@ "id": "group:string:UNFCCC.family.1060.0", "relevance": 9.07481177458161, "value": "UNFCCC.family.1060.0", + "fields": { + "count()": 21 + }, "children": [ { "id": "hitlist:hits", diff --git a/tests/test_search_adaptors.py b/tests/test_search_adaptors.py index a5aecd39..3f07a4fe 100644 --- a/tests/test_search_adaptors.py +++ b/tests/test_search_adaptors.py @@ -19,8 +19,13 @@ def vespa_search(cert_directory: str, request: SearchParameters) -> SearchRespon @pytest.mark.vespa def test_vespa_search_adaptor__works(fake_vespa_credentials): - request = SearchParameters(query_string="forest fires") - vespa_search(fake_vespa_credentials, request) + request = SearchParameters(query_string="the") + response = vespa_search(fake_vespa_credentials, request) + + assert len(response.families) == response.total_family_hits == 2 + assert response.query_time_ms < response.total_time_ms + total_passage_count = sum([f.total_passage_hits for f in response.families]) + assert total_passage_count == response.total_hits @pytest.mark.vespa