Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata at the passage level #109

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cpr_sdk/models/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)


Expand Down
2 changes: 1 addition & 1 deletion src/cpr_sdk/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
_MAJOR = "1"
_MINOR = "6"
_PATCH = "0"
_PATCH = "1"
_SUFFIX = ""

VERSION_SHORT = "{0}.{1}".format(_MAJOR, _MINOR)
Expand Down
2 changes: 2 additions & 0 deletions tests/local_vespa/test_app/schemas/document_passage.sd
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {}
Expand Down
1 change: 1 addition & 0 deletions tests/test_search_adaptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading