unified-storage: restrict search to title of documents (#111842)

* restrict search to title of documents
This commit is contained in:
Will Assis
2025-10-01 08:06:26 -04:00
committed by GitHub
parent 8f8e4a881a
commit 870131a4aa
3 changed files with 55 additions and 2 deletions
@@ -164,14 +164,18 @@ func runTestResourceIndex(t *testing.T, backend resource.SearchBackend, nsPrefix
Group: ns.Group,
Resource: ns.Resource,
},
Fields: []*resourcepb.Requirement{{
Key: "tags",
Operator: "=",
Values: []string{"tag3"},
}},
},
Fields: []string{"title", "folder", "tags"},
Query: "tag3",
Limit: 10,
}, nil)
require.NoError(t, err)
require.NotNil(t, resp)
require.Equal(t, int64(1), resp.TotalHits) // Only doc3 should have tag3 now
require.Equal(t, int64(1), resp.TotalHits) // Only doc2 should have tag3 now
// Search for Document
resp, err = index.Search(ctx, nil, &resourcepb.ResourceSearchRequest{