mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 12:28:48 +01:00
🎨 Marketplace search for multiple keywords uses AND logic https://github.com/siyuan-note/siyuan/issues/14293
This commit is contained in:
parent
09e52d3c54
commit
bc1c2ef5c5
1 changed files with 6 additions and 4 deletions
|
|
@ -501,7 +501,7 @@ func matchPackage(keywords []string, pkg *bazaar.Package) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
hitCount := 0
|
||||
hits := map[string]bool{}
|
||||
for _, keyword := range keywords {
|
||||
if strings.Contains(strings.ToLower(pkg.DisplayName.Default), keyword) ||
|
||||
strings.Contains(strings.ToLower(pkg.DisplayName.ZhCN), keyword) ||
|
||||
|
|
@ -513,16 +513,18 @@ func matchPackage(keywords []string, pkg *bazaar.Package) bool {
|
|||
strings.Contains(strings.ToLower(pkg.Description.EnUS), keyword) ||
|
||||
strings.Contains(strings.ToLower(path.Base(pkg.RepoURL)), keyword) ||
|
||||
strings.Contains(strings.ToLower(pkg.Author), keyword) {
|
||||
hitCount++
|
||||
hits[keyword] = true
|
||||
continue
|
||||
}
|
||||
|
||||
for _, pkgKeyword := range pkg.Keywords {
|
||||
if strings.Contains(strings.ToLower(pkgKeyword), keyword) {
|
||||
hitCount++
|
||||
hits[keyword] = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return hitCount == len(keywords)
|
||||
return len(hits) == len(keywords)
|
||||
}
|
||||
|
||||
func getSearchKeywords(query string) (ret []string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue