Vespa edge case ID does not follow expected format (#541)

This commit is contained in:
Yuhong Sun
2023-10-08 13:36:00 -07:00
committed by GitHub
parent e8d3190770
commit 9b185f469f

View File

@@ -104,7 +104,13 @@ def _get_vespa_chunk_ids_by_document_id(
while True:
results = requests.get(SEARCH_ENDPOINT, params=params).json()
hits = results["root"].get("children", [])
doc_chunk_ids.extend([hit["id"].split("::")[1] for hit in hits])
# Temporary logging to catch the rare index out of bounds issue
problematic_ids = [hit["id"] for hit in hits if len(hit["id"].split("::")) < 2]
if problematic_ids:
logger.error(f'IDs without "::" {problematic_ids}')
doc_chunk_ids.extend([hit["id"].split("::", 1)[-1] for hit in hits])
params["offset"] += hits_per_page # type: ignore
if len(hits) < hits_per_page: