fixed search bug

This commit is contained in:
Graham Steffaniak 2023-07-30 17:35:30 -05:00
parent c475ac6fa8
commit b8af3f8147
2 changed files with 5 additions and 5 deletions

View File

@ -26,9 +26,9 @@ var compressedFile = []string{
} }
type searchOptions struct { type searchOptions struct {
Conditions map[string]bool Conditions map[string]bool
Size int Size int
Terms []string Terms []string
} }
func ParseSearch(value string) *searchOptions { func ParseSearch(value string) *searchOptions {
@ -59,6 +59,7 @@ func ParseSearch(value string) *searchOptions {
case "folder" : opts.Conditions["dir"] = true case "folder" : opts.Conditions["dir"] = true
case "file" : opts.Conditions["dir"] = false case "file" : opts.Conditions["dir"] = false
} }
if len(filter) < 8 { if len(filter) < 8 {
continue continue
} }
@ -90,7 +91,8 @@ func ParseSearch(value string) *searchOptions {
opts.Terms = []string{unique} opts.Terms = []string{unique}
return opts return opts
} }
re := regexp.MustCompile(` +`)
value = re.ReplaceAllString(value, " ")
opts.Terms = strings.Split(value, " ") opts.Terms = strings.Split(value, " ")
return opts return opts
} }

View File

@ -9,8 +9,6 @@
"watch": "find ./dist -maxdepth 1 -mindepth 1 ! -name '.gitignore' -exec rm -r {} + && vue-cli-service build --watch --no-clean" "watch": "find ./dist -maxdepth 1 -mindepth 1 ! -name '.gitignore' -exec rm -r {} + && vue-cli-service build --watch --no-clean"
}, },
"dependencies": { "dependencies": {
"normalize.css": "^8.0.1",
"file-loader": "^6.2.0",
"ace-builds": "^1.4.7", "ace-builds": "^1.4.7",
"clipboard": "^2.0.4", "clipboard": "^2.0.4",
"css-vars-ponyfill": "^2.4.3", "css-vars-ponyfill": "^2.4.3",