fix: close internal semantic review gaps
This commit is contained in:
@@ -94,14 +94,11 @@ class QdrantVectorStore:
|
||||
expected_dimension=self._expected_dimension,
|
||||
)
|
||||
|
||||
dimensions = ()
|
||||
compatible = None
|
||||
if info is not None:
|
||||
dimension = info["config"]["params"]["vectors"]["size"]
|
||||
dimensions = (dimension,)
|
||||
compatible = (
|
||||
None if self._expected_dimension is None else dimensions == (self._expected_dimension,)
|
||||
)
|
||||
dimension = info["config"]["params"]["vectors"]["size"]
|
||||
dimensions = (dimension,)
|
||||
compatible = (
|
||||
None if self._expected_dimension is None else dimensions == (self._expected_dimension,)
|
||||
)
|
||||
return VectorHealth(
|
||||
ok=compatible is not False,
|
||||
read_configured=True,
|
||||
@@ -142,12 +139,11 @@ class QdrantVectorStore:
|
||||
or not isinstance(workspace_id, str)
|
||||
):
|
||||
raise VectorStoreError("Invalid vector metadata filter")
|
||||
filter_must = [
|
||||
{"key": "workspace_id", "match": {"value": workspace_id}},
|
||||
{"key": "record_kind", "match": {"any": allowed_record_kinds}},
|
||||
self._require_bound_workspace(workspace_id)
|
||||
filter_must.extend([
|
||||
{"key": "vector_generation", "match": {"value": generation}},
|
||||
{"key": "document_id", "match": {"any": document_ids}},
|
||||
]
|
||||
])
|
||||
response = self._call(
|
||||
"POST",
|
||||
f"/collections/{self._collection}/points/query",
|
||||
@@ -232,27 +228,19 @@ class QdrantVectorStore:
|
||||
raise VectorStoreError("Only exact Evidence generations may be deleted")
|
||||
if _WORKSPACE.fullmatch(workspace_id) is None:
|
||||
raise VectorStoreError("Invalid Evidence workspace namespace")
|
||||
self._require_bound_workspace(workspace_id)
|
||||
must = [
|
||||
*self._workspace_filter(),
|
||||
{"key": "record_kind", "match": {"any": ["evidence"]}},
|
||||
{"key": "vector_generation", "match": {"value": generation}},
|
||||
]
|
||||
before = len(
|
||||
self._scroll(
|
||||
[
|
||||
{"key": "workspace_id", "match": {"value": workspace_id}},
|
||||
{"key": "record_kind", "match": {"any": ["evidence"]}},
|
||||
{"key": "vector_generation", "match": {"value": generation}},
|
||||
]
|
||||
)
|
||||
self._scroll(must)
|
||||
)
|
||||
self._call(
|
||||
"POST",
|
||||
f"/collections/{self._collection}/points/delete?wait=true",
|
||||
{
|
||||
"filter": {
|
||||
"must": [
|
||||
{"key": "workspace_id", "match": {"value": workspace_id}},
|
||||
{"key": "record_kind", "match": {"any": ["evidence"]}},
|
||||
{"key": "vector_generation", "match": {"value": generation}},
|
||||
]
|
||||
}
|
||||
},
|
||||
{"filter": {"must": must}},
|
||||
)
|
||||
return before
|
||||
|
||||
@@ -261,9 +249,10 @@ class QdrantVectorStore:
|
||||
raise VectorStoreError("Only exact Evidence generations may be listed")
|
||||
if _WORKSPACE.fullmatch(workspace_id) is None:
|
||||
raise VectorStoreError("Invalid Evidence workspace namespace")
|
||||
self._require_bound_workspace(workspace_id)
|
||||
points = self._scroll(
|
||||
[
|
||||
{"key": "workspace_id", "match": {"value": workspace_id}},
|
||||
*self._workspace_filter(),
|
||||
{"key": "record_kind", "match": {"any": ["evidence"]}},
|
||||
]
|
||||
)
|
||||
@@ -279,6 +268,10 @@ class QdrantVectorStore:
|
||||
def _workspace_filter(self) -> list[dict]:
|
||||
return [{"key": "workspace_id", "match": {"value": self._workspace_id}}]
|
||||
|
||||
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")
|
||||
|
||||
def _allowed_record_kinds(
|
||||
self, collections: list[str], kinds: list[str] | None
|
||||
) -> list[str]:
|
||||
@@ -303,7 +296,7 @@ class QdrantVectorStore:
|
||||
response = self._call("GET", f"/collections/{self._collection}", None, allow_missing=True)
|
||||
if response is None:
|
||||
if not strict:
|
||||
return None
|
||||
raise VectorStoreError("Qdrant collection is missing")
|
||||
self._call(
|
||||
"PUT",
|
||||
f"/collections/{self._collection}",
|
||||
@@ -329,6 +322,8 @@ class QdrantVectorStore:
|
||||
raise VectorStoreError("Qdrant collection configuration mismatch")
|
||||
for field_name in _KEYWORD_INDEXES:
|
||||
if field_name not in result.get("payload_schema", {}):
|
||||
if not strict:
|
||||
raise VectorStoreError("Qdrant collection payload indexes mismatch")
|
||||
self._call(
|
||||
"PUT",
|
||||
f"/collections/{self._collection}/index",
|
||||
|
||||
Reference in New Issue
Block a user