community[patch]: Ignore null and invalid embedding values for neo4j metadata filtering (#20558)

pull/20012/head^2
Tomaz Bratanic 3 months ago committed by GitHub
parent 718c9cbe3a
commit 27370b679e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -956,8 +956,17 @@ class Neo4jVector(VectorStore):
"Metadata filtering can't be use in combination with "
"a hybrid search approach"
)
parallel_query = "CYPHER runtime = parallel " if self._is_enterprise else ""
base_index_query = parallel_query + f"MATCH (n:`{self.node_label}`) WHERE "
parallel_query = (
"CYPHER runtime = parallel parallelRuntimeSupport=all "
if self._is_enterprise
else ""
)
base_index_query = parallel_query + (
f"MATCH (n:`{self.node_label}`) WHERE "
f"n.`{self.embedding_node_property}` IS NOT NULL AND "
f"size(n.`{self.embedding_node_property}`) = "
f"toInteger({self.embedding_dimension}) AND "
)
base_cosine_query = (
" WITH n as node, vector.similarity.cosine("
f"n.`{self.embedding_node_property}`, "

Loading…
Cancel
Save