[search] mimic sql search (#99526)

This commit is contained in:
Scott Lepper 2025-01-27 08:03:39 -05:00 committed by GitHub
parent 394d081df2
commit 629b20700c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -574,7 +574,12 @@ func (b *bleveIndex) toBleveSearchRequest(ctx context.Context, req *resource.Res
// Add a text query
if req.Query != "" && req.Query != "*" {
searchrequest.Fields = append(searchrequest.Fields, resource.SEARCH_FIELD_SCORE)
queries = append(queries, bleve.NewFuzzyQuery(req.Query))
// mimic the behavior of the sql search
query := req.Query
if !strings.Contains(query, "*") {
query = "*" + query + "*"
}
queries = append(queries, bleve.NewWildcardQuery(query))
}
switch len(queries) {