Change the code search to sort results by relevance (#32134)

Resolves #32129

Signed-off-by: Bruno Sofiato <bruno.sofiato@gmail.com>
This commit is contained in:
Bruno Sofiato authored and GitHub committed 2024-09-28 20:13:55 +00:00
1 parent ad749fbf25
commit 99d0510cb6
2 files changed
+6 -2

No files matched your search

+2
View File
@@ -284,6 +284,8 @@ func (b *Indexer) Search(ctx context.Context, opts *internal.SearchOptions) (int
searchRequest.AddFacet("languages", bleve.NewFacetRequest("Language", 10))
}
searchRequest.SortBy([]string{"-_score", "UpdatedAt"})
result, err := b.inner.Indexer.SearchInContext(ctx, searchRequest)
if err != nil {
return 0, nil, nil, err