From f5efff8d6d5e89cdb7708c98521d5aa67e81a366 Mon Sep 17 00:00:00 2001 From: buua436 Date: Tue, 18 Aug 2026 09:41:27 +0800 Subject: [PATCH] fix: exclude compiled artifacts from chunk lists (#18382) --- internal/service/chunk/chunk.go | 3 ++- internal/service/chunk/chunk_test.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/service/chunk/chunk.go b/internal/service/chunk/chunk.go index d18560e463..23a34f8f39 100644 --- a/internal/service/chunk/chunk.go +++ b/internal/service/chunk/chunk.go @@ -882,7 +882,8 @@ func (s *ChunkService) List(ctx context.Context, req *service.ListChunksRequest, "available_int", }, Filter: map[string]interface{}{ - "doc_id": req.DocID, + "doc_id": req.DocID, + "must_not": map[string]interface{}{"exists": "compile_kwd"}, }, } diff --git a/internal/service/chunk/chunk_test.go b/internal/service/chunk/chunk_test.go index 0bd56765ee..27ddf47e7a 100644 --- a/internal/service/chunk/chunk_test.go +++ b/internal/service/chunk/chunk_test.go @@ -405,6 +405,10 @@ func TestListBuildsMatchTextExprForKeywords(t *testing.T) { if got := engine.searchReq.Filter["doc_id"]; got != documentID { t.Fatalf("doc_id filter = %#v, want %q", got, documentID) } + mustNot, ok := engine.searchReq.Filter["must_not"].(map[string]interface{}) + if !ok || mustNot["exists"] != "compile_kwd" { + t.Fatalf("must_not filter = %#v, want compile_kwd existence exclusion", engine.searchReq.Filter["must_not"]) + } if slices.Contains(engine.searchReq.SelectFields, "content") { t.Fatalf("SelectFields = %#v, should not request content with content_with_weight", engine.searchReq.SelectFields) }