Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Conversation

@Kavi-25
Copy link

@Kavi-25 Kavi-25 commented Oct 16, 2025

🩹 Fix: QdrantVectorSearchTool returns only one result when limit > 1

Root Cause:
The query_points() method returns a QueryResponse object whose points attribute holds the list of ScoredPoint results.
However, when iterating directly over the search_result object, Pydantic’s BaseModel.iter yields key-value pairs (e.g. ('points', [points])).
As a result, the loop consumed only one iteration, producing a single record instead of the full result set.

Fix:
Iterate over search_result.points explicitly rather than over search_result itself:

❌ Before

for point in search_results:
result = {
"metadata": point[1][0].payload.get("metadata", {}),
"context": point[1][0].payload.get("text", ""),
"distance": point[1][0].score,
}
results.append(result)

✅ After

for point in search_results.points:
result = {
"metadata": point.payload.get("metadata", {}),
"context": point.payload.get("text", ""),
"distance": point.score,
}
results.append(result)

Outcome:
QdrantVectorSearchTool now respects the limit parameter and correctly returns all requested points.

Impact:
This fix ensures proper pagination and multi-result behavior in all vector search queries.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant