Skip to content

Commit

Permalink
quick nit
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Jan 8, 2025
1 parent 86d9829 commit 85fa327
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
9 changes: 1 addition & 8 deletions backend/onyx/document_index/vespa/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,8 @@ def update_single_chunk(
) -> None:
"""
Update a single "chunk" (document) in Vespa using its chunk ID.
Requires that 'index_name' matches the document type in your Vespa schema.
"""

# 1) Build the partial-update JSON
update_dict: dict[str, dict] = {"fields": {}}

if fields.boost is not None:
Expand All @@ -542,7 +540,7 @@ def update_single_chunk(
}

if fields.access is not None:
# Another WeightedSet<string>
# Similar to above
update_dict["fields"][ACCESS_CONTROL_LIST] = {
"assign": {acl_entry: 1 for acl_entry in fields.access.to_acl()}
}
Expand All @@ -554,10 +552,6 @@ def update_single_chunk(
logger.error("Update request received but nothing to update.")
return

# 2) Construct the correct doc URL
# Make sure DOCUMENT_ID_ENDPOINT includes something like:
# http://<host>:<port>/document/v1/{namespace}/{doc_type}/docid
# Also note the "?create=true" so that partial updates upsert.
vespa_url = f"{DOCUMENT_ID_ENDPOINT.format(index_name=index_name)}/{doc_chunk_id}?create=true"

with get_vespa_http_client(http2=False) as http_client:
Expand Down Expand Up @@ -637,7 +631,6 @@ def delete_single(
tenant_id: str | None,
chunk_count: int | None,
) -> int:
print("\n\n\n\n\n\n\n\nDELETE")
total_chunks_deleted = 0

doc_id = replace_invalid_doc_id_characters(doc_id)
Expand Down
2 changes: 0 additions & 2 deletions backend/tests/integration/common_utils/managers/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ def _verify_document_permissions(

if group_names is not None:
expected_group_keys = {f"group:{group_name}" for group_name in group_names}
print(f"Expected group keys: {expected_group_keys}")
found_group_keys = {key for key in acl_keys if key.startswith("group:")}
print(f"Found group keys: {found_group_keys}")
if found_group_keys != expected_group_keys:
raise ValueError(
f"Document {retrieved_doc['document_id']} has incorrect group ACL keys. "
Expand Down

0 comments on commit 85fa327

Please sign in to comment.