lplalbert commented on code in PR #414:
URL: https://github.com/apache/hugegraph-ai/pull/414#discussion_r4579813772
##########
hugegraph-llm/src/hugegraph_llm/indices/vector_index/base.py:
##########
@@ -38,9 +38,12 @@ def add(self, vectors: List[List[float]], props: List[Any]):
"""
@abstractmethod
- def get_all_properties(self) -> list[str]:
+ def get_all_properties(self) -> list[Any]:
"""
- #TODO: finish comment
+ Return all properties currently stored in the index.
+
+ Returns:
+ List[Any]: The values previously passed to add().
Review Comment:
Documented in `59db519`, taking your "document these backend differences"
branch.
Root cause: the docstring promised "the values previously passed to add()",
but the read-back form is storage-defined — text-column backends (Milvus) keep
the property as text, so a stored dict comes back as its JSON text, and its
query path also dropped empty strings server-side. A verbatim promise could
only hold for strings.
Structural fix: `add()` now carries the round-trip contract and the read
methods reference it — string properties (including JSON-shaped text like `123`
and empty strings) round-trip unchanged on every backend; non-string values
come back in their backend storage form (file-backed pickle keeps the original
values, server-backed JSON payloads keep JSON-representable values, text
columns return the JSON text). Input APIs (`add`, `remove`) take the original
values; read APIs (`search`, `get_all_properties`) return the stored form.
Callers pass strings for exact round trip. The stated behavior for strings —
including the empty-string and JSON-shaped cases — is implemented at the
producing boundary in #412 (`129cc48` removed Milvus' `json.loads` decode and
its `property != ""` filter), so if this PR lands first the doc describes that
head's behavior for a moment.
Validation: docstring-only change — `ruff format --check` / `ruff check` /
`ty check` clean on the file, `pytest hugegraph-llm/src/tests/indices` 21
passed / 1 skipped. The string round trip is pinned per backend in tests
(Qdrant real-client round trip here; Milvus JSON-shaped-text and empty-string
round trip in #412's `test_optional_vector_clients.py`); non-string storage
form stays documented-only, as this thread allows. Remaining cleanup: none in
this scope.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]