fix(library-desk): update Qdrant client to use query_points API
The Qdrant client API changed from search() to query_points(). Updated both search() and find_similar_chunks() methods. All integration tests now passing: 14/14 ✓ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -195,9 +195,9 @@ class QdrantClientWrapper:
|
||||
query_filter = Filter(must=conditions)
|
||||
|
||||
try:
|
||||
results = self.client.search(
|
||||
response = self.client.query_points(
|
||||
collection_name=collection_name,
|
||||
query_vector=query_vector,
|
||||
query=query_vector,
|
||||
limit=limit,
|
||||
score_threshold=score_threshold,
|
||||
query_filter=query_filter,
|
||||
@@ -206,14 +206,14 @@ class QdrantClientWrapper:
|
||||
|
||||
return [
|
||||
{
|
||||
"id": str(result.id),
|
||||
"score": result.score,
|
||||
"doc_id": result.payload["doc_id"],
|
||||
"chunk_index": result.payload["chunk_index"],
|
||||
"content": result.payload["content"],
|
||||
"metadata": result.payload.get("metadata", {})
|
||||
"id": str(point.id),
|
||||
"score": point.score,
|
||||
"doc_id": point.payload["doc_id"],
|
||||
"chunk_index": point.payload["chunk_index"],
|
||||
"content": point.payload["content"],
|
||||
"metadata": point.payload.get("metadata", {})
|
||||
}
|
||||
for result in results
|
||||
for point in response.points
|
||||
]
|
||||
except Exception as e:
|
||||
logger.error(f"Search failed: {e}", exc_info=True)
|
||||
@@ -386,9 +386,9 @@ class QdrantClientWrapper:
|
||||
# (could aggregate multiple chunks for better results)
|
||||
first_vector = source_points[0].vector
|
||||
|
||||
results = self.client.search(
|
||||
response = self.client.query_points(
|
||||
collection_name=collection_name,
|
||||
query_vector=first_vector,
|
||||
query=first_vector,
|
||||
limit=limit * 2, # Get more to filter out same doc
|
||||
with_payload=True
|
||||
)
|
||||
@@ -396,13 +396,13 @@ class QdrantClientWrapper:
|
||||
# Filter out chunks from same document
|
||||
similar = [
|
||||
{
|
||||
"id": str(r.id),
|
||||
"score": r.score,
|
||||
"doc_id": r.payload["doc_id"],
|
||||
"content": r.payload["content"]
|
||||
"id": str(point.id),
|
||||
"score": point.score,
|
||||
"doc_id": point.payload["doc_id"],
|
||||
"content": point.payload["content"]
|
||||
}
|
||||
for r in results
|
||||
if r.payload["doc_id"] != doc_id
|
||||
for point in response.points
|
||||
if point.payload["doc_id"] != doc_id
|
||||
]
|
||||
|
||||
return similar[:limit]
|
||||
|
||||
Reference in New Issue
Block a user