A strange bug(or my mistake) in 4.4b8 with weaviate 1.23.3(1.23.6 still the same)
uuid = "b4c4b93e-10ef-5098-b525-cd2bd29f1870"
print("-------------")
result1 = client.collections.get("FileData").query.fetch_objects(
filters=Filter.by_id().equal(uuid)
)
print("fetch_objects:", result1)
result2 = client.collections.get("FileData").query.fetch_object_by_id(
uuid=uuid
)
print("fetch_object_by_id:", result2)
I think the two approch should have the same result but it turned out not.
the result is
fetch_objects: QueryReturn(objects=[Object(uuid=_WeaviateUUIDInt(‘b4c4b93e-10ef-5098-b525-cd2bd29f1870’), metadata=MetadataReturn(creation_time=None, last_update_time=None, distance=None, certainty=None, score=None, explain_score=None, is_consistent=None, rerank_score=None), properties={‘hash’: ‘file_hash_0’, ‘status’: 0}, references=None, vector=None, collection=‘FileData’)])
fetch_object_by_id: None
I don’t know why fetch_object_by_id can’t get the objects
EDIT:
After some digging I find under the hood fetch_object_by_id also uses filters=Filter.by_id().equal(uuid) to filter the object but the only differernce is it add a limit=1 parameter.It turns out the limit=1 somehow make it not get the object.
I tried
result1 = client.collections.get("FileData").query.fetch_objects(
filters=Filter.by_id().equal(uuid),
limit=1
)