diff --git a/src/cpr_sdk/models/search.py b/src/cpr_sdk/models/search.py index 82b4a55..0d85933 100644 --- a/src/cpr_sdk/models/search.py +++ b/src/cpr_sdk/models/search.py @@ -404,6 +404,7 @@ def from_vespa_response(cls, response_hit: dict) -> "Passage": text_block_type=fields["text_block_type"], text_block_page=fields.get("text_block_page"), text_block_coords=fields.get("text_block_coords"), + metadata=fields.get("metadata"), ) diff --git a/src/cpr_sdk/version.py b/src/cpr_sdk/version.py index 26f57ad..3fba0a6 100644 --- a/src/cpr_sdk/version.py +++ b/src/cpr_sdk/version.py @@ -1,6 +1,6 @@ _MAJOR = "1" _MINOR = "6" -_PATCH = "0" +_PATCH = "1" _SUFFIX = "" VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR) diff --git a/tests/local_vespa/test_app/schemas/document_passage.sd b/tests/local_vespa/test_app/schemas/document_passage.sd index 69d2d9d..8f2f3df 100644 --- a/tests/local_vespa/test_app/schemas/document_passage.sd +++ b/tests/local_vespa/test_app/schemas/document_passage.sd @@ -64,6 +64,7 @@ schema document_passage { import field family_document_ref.document_source_url as document_source_url {} import field family_document_ref.corpus_import_id as corpus_import_id {} import field family_document_ref.corpus_type_name as corpus_type_name {} + import field family_document_ref.metadata as metadata {} import field search_weights_ref.passage_weight as passage_weight {} fieldset default { @@ -88,6 +89,7 @@ schema document_passage { summary document_source_url {} summary corpus_import_id {} summary corpus_type_name {} + summary metadata {} summary text_block {} summary text_block_id {} summary text_block_type {} diff --git a/tests/test_search_adaptors.py b/tests/test_search_adaptors.py index 4505914..0e57673 100644 --- a/tests/test_search_adaptors.py +++ b/tests/test_search_adaptors.py @@ -523,6 +523,7 @@ def test_vespa_search_adaptor__metadata(test_vespa, query_string, metadata_filte response = vespa_search(test_vespa, request) assert response.total_family_hits > 0 for family in response.families: + assert len(family.hits) > 0 for hit in family.hits: assert hit.metadata not in [None, []] for metadata_filter in metadata_filters: