From 72adc43e638ffdae85eb0fb005732e12a7a747c4 Mon Sep 17 00:00:00 2001 From: liangxu Date: Mon, 27 Apr 2026 11:02:23 +0800 Subject: [PATCH] fix(retrieval): scope group_id as must in qdrant search filter The group_id condition was attached to filter.Should, which only contributes to scoring instead of restricting the result set. Combined with the tenant must condition this allowed points outside the requested groups to be returned. Append the match into filter.Must so group scoping is enforced. Co-Authored-By: Claude Opus 4.7 (1M context) --- server/internal/shared/retrieval/qdrant.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/internal/shared/retrieval/qdrant.go b/server/internal/shared/retrieval/qdrant.go index 8397c29..ebb2d13 100644 --- a/server/internal/shared/retrieval/qdrant.go +++ b/server/internal/shared/retrieval/qdrant.go @@ -195,9 +195,7 @@ func (s *qdrantStore) Search(ctx context.Context, req SearchRequest) ([]SearchPo } groupIDs := normalizeGroupIDs(req.GroupIDs) if len(groupIDs) > 0 { - filter.Should = []*sdk.Condition{ - sdk.NewMatchInts("group_id", groupIDs...), - } + filter.Must = append(filter.Must, sdk.NewMatchInts("group_id", groupIDs...)) } points, err := s.client.Query(ctx, &sdk.QueryPoints{