Comments (2)
I have a more thorough example of the problem and I now think it is related to use combined filter on reference
here is the link of the post on weaviate support forum.
https://forum.weaviate.io/t/combined-filter-on-reference-has-unexpect-behaviour/1683
the code to reproduce the problem
import weaviate
from weaviate.collections.classes.config import Property, DataType, ReferenceProperty
from weaviate.collections.classes.filters import Filter
from weaviate.collections.classes.grpc import QueryReference
from base_dependencies import load_config
client = weaviate.connect_to_custom(
http_host=load_config("weaviate")["host"],
http_port=load_config("weaviate")["http_port"],
http_secure=False,
grpc_host="localhost",
grpc_port=load_config("weaviate")["grpc_port"],
grpc_secure=False,
auth_credentials=weaviate.auth.AuthApiKey(api_key=load_config("weaviate")["api_key"])
)
client.collections.delete(["a", "b", ])
b = client.collections.create(
"b",
properties=[
Property(name="text", data_type=DataType.TEXT),
Property(name="code", data_type=DataType.TEXT),
],
)
a = client.collections.create(
name="a", references=[ReferenceProperty(name="has_b", target_collection=b.name)]
)
b1 = b.data.insert(properties={"text": "text1", "code": "1752871214070435840321"})
b2 = b.data.insert(properties={"text": "text2", "code": "1752871214070435840521"})
b3 = b.data.insert(properties={"text": "text3", "code": "1752871214070435840621"})
b4 = b.data.insert(properties={"text": "text4", "code": "1752871214070435840721"})
a1 = a.data.insert({}, references={"has_b": [b1, b2]})
a2 = a.data.insert({}, references={"has_b": [b3, b4]})
a_objects = a.query.fetch_objects(
filters=Filter.by_ref("has_b").by_property("code").greater_or_equal("1752871214070435840326")
& Filter.by_ref("has_b").by_property("code").less_or_equal("1752871214070435840327"),
return_references=[
QueryReference(
link_on="has_b",
return_properties=["code"]
)
]
).objects
# should be no object returned, because no code is between 1752871214070435840326 and 1752871214070435840327
print("record count:", len(a_objects))
for a_object in a_objects:
print("------")
print("a_object_uuid:", a_object.uuid)
for ref in a_object.references["has_b"].objects:
print(ref.properties["code"])
print("------")
# but it returns 1 objects
# the object has two has_b reference code="1752871214070435840321" and "1752871214070435840521"
# if we use the same filter on b collection, it returns 0 objects.work as expected
b_objects = b.query.fetch_objects(
filters=Filter.by_property("code").greater_or_equal("1752871214070435840326")
& Filter.by_property("code").less_or_equal("1752871214070435840327"),
).objects
print("============================================")
print("record count:", len(b_objects))
for b_object in b_objects:
print(b_object)
client.close()
from weaviate.
I found it is my mistake.closed
from weaviate.
Related Issues (20)
- Remove blank space from weaviate readme
- Epic: Cluster refactoring
- Epic: RAFT Stability and observability
- autoTenantCreation not working - object insert returns tenant not found HOT 2
- How to use weaviate DB in Production with RAG ? HOT 3
- [flat index] Switch from `objects` to `vectors for rescoring BQ
- Refactor schema interface usage to have unified naming and simpler updates
- Refactor struct intertwined in `cluster` package to have a clear consistent naming and usage.
- Read-repair re-adds objects that should have been deleted
- Initialisation script to set up initial data, schema, etc in container
- RAFT Deadlock on race condition on multi tenancy config read
- SIMD support for Scalar Quantisation
- Add distiluse-base-multilingual-cased-v2 transformer for embeddings
- "VectorFromSearchParam was called without any known params present" is unhelpful
- Description cannot be changed in 1.25.1
- AttributeError: 'Client' object has no attribute 'collections' HOT 3
- Restarts after HNSW delete cleanup cycles can lead to "Phantom Tombstones"
- Rolling update is not zero-downtime despite replication if shard loading time is long
- runtime error: slice bounds out of range HOT 1
- X-Google-Vertex-Api-Key doesn't work with Vertex models
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weaviate.