fix(query): improve multi-term search ranking and filtering (#2926)
- Join search terms with space instead of empty separator so Jaro-Winkler similarity compares against realistic strings (e.g. 'linux ck' vs 'linuxck') - Change matchesSearch symbol check from early return to continue so non-symbol terms in multi-term queries are still filtered instead of being bypassed
This commit is contained in:
1 file changed
+2
-2
@@ -195,7 +195,7 @@ func (s *SourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor
|
||||
|
||||
sortableResults := &abstractResults{
|
||||
results: []abstractResult{},
|
||||
search: strings.ToLower(strings.Join(pkgS, "")),
|
||||
search: strings.ToLower(strings.Join(pkgS, " ")),
|
||||
metric: metric,
|
||||
separateSources: s.separateSources,
|
||||
repoOrder: dbExecutor.Repos(),
|
||||
@@ -341,7 +341,7 @@ func matchesSearch(pkg *aur.Pkg, terms []string) bool {
|
||||
desc := strings.ToLower(pkg.Description)
|
||||
for _, pkgN := range terms {
|
||||
if strings.ContainsFunc(pkgN, unicode.IsSymbol) {
|
||||
return true
|
||||
continue
|
||||
}
|
||||
|
||||
targ := strings.ToLower(pkgN)
|
||||
|
||||
Reference in new issue
Block a user