fix: close semantic isolation review gaps
This commit is contained in:
@@ -125,6 +125,7 @@ class QdrantVectorStore:
|
||||
if not allowed_record_kinds:
|
||||
return []
|
||||
filter_must = self._workspace_filter()
|
||||
filter_must.append(self._semantic_kind_filter(allowed_record_kinds))
|
||||
filter_must.append({"key": "record_kind", "match": {"any": allowed_record_kinds}})
|
||||
if metadata_filter is not None:
|
||||
if set(metadata_filter) != {"vector_generation", "document_ids", "workspace_id"}:
|
||||
@@ -166,6 +167,7 @@ class QdrantVectorStore:
|
||||
points = self._scroll(
|
||||
[
|
||||
*self._workspace_filter(),
|
||||
self._semantic_kind_filter(kinds),
|
||||
{"key": "record_kind", "match": {"any": sorted(kinds)}},
|
||||
]
|
||||
)
|
||||
@@ -213,6 +215,7 @@ class QdrantVectorStore:
|
||||
validate_collection_kinds(collection, kinds)
|
||||
must = [
|
||||
*self._workspace_filter(),
|
||||
self._semantic_kind_filter(kinds),
|
||||
{"key": "record_kind", "match": {"any": sorted(kinds)}},
|
||||
]
|
||||
before = len(self._scroll(must))
|
||||
@@ -231,6 +234,7 @@ class QdrantVectorStore:
|
||||
self._require_bound_workspace(workspace_id)
|
||||
must = [
|
||||
*self._workspace_filter(),
|
||||
{"key": "kind", "match": {"value": "evidence"}},
|
||||
{"key": "record_kind", "match": {"any": ["evidence"]}},
|
||||
{"key": "vector_generation", "match": {"value": generation}},
|
||||
]
|
||||
@@ -253,6 +257,7 @@ class QdrantVectorStore:
|
||||
points = self._scroll(
|
||||
[
|
||||
*self._workspace_filter(),
|
||||
{"key": "kind", "match": {"value": "evidence"}},
|
||||
{"key": "record_kind", "match": {"any": ["evidence"]}},
|
||||
]
|
||||
)
|
||||
@@ -268,6 +273,10 @@ class QdrantVectorStore:
|
||||
def _workspace_filter(self) -> list[dict]:
|
||||
return [{"key": "workspace_id", "match": {"value": self._workspace_id}}]
|
||||
|
||||
def _semantic_kind_filter(self, record_kinds: list[str]) -> dict:
|
||||
semantic_kinds = sorted({qdrant_semantic_kind(kind) for kind in record_kinds})
|
||||
return {"key": "kind", "match": {"any": semantic_kinds}}
|
||||
|
||||
def _require_bound_workspace(self, workspace_id: str) -> None:
|
||||
if workspace_id != self._workspace_id:
|
||||
raise VectorStoreError("Evidence workspace namespace does not match bound workspace")
|
||||
|
||||
Reference in New Issue
Block a user