diff --git a/backend/search/indexing.go b/backend/search/indexing.go index c11ac4ed..4b9f0b43 100644 --- a/backend/search/indexing.go +++ b/backend/search/indexing.go @@ -184,6 +184,7 @@ func containsSearchTerm(pathName string, searchTerm string, options searchOption fileTypes := map[string]bool{} fileSize := getFileSize(pathName) matchesCondition := false + matchesAllConditions := true extension := filepath.Ext(strings.ToLower(path)) mimetype := mime.TypeByExtension(extension) fileTypes["audio"] = strings.HasPrefix(mimetype, "audio") @@ -192,7 +193,7 @@ func containsSearchTerm(pathName string, searchTerm string, options searchOption fileTypes["doc"] = isDoc(extension) fileTypes["archive"] = isArchive(extension) fileTypes["dir"] = isDir - anyFilter := false + for t,v := range conditions { switch t { case "exact" : continue @@ -200,12 +201,12 @@ func containsSearchTerm(pathName string, searchTerm string, options searchOption case "smaller" : matchesCondition = fileSize < int64(options.Size) * 1000000 default : matchesCondition = v == fileTypes[t] } - anyFilter = true + if (!matchesCondition) { + matchesAllConditions = false + } } - if !anyFilter { - matchesCondition = true - } - return matchesCondition, fileTypes + + return matchesAllConditions, fileTypes } return false, map[string]bool{} } diff --git a/frontend/src/components/Search.vue b/frontend/src/components/Search.vue index c4823010..e0e1bdc1 100644 --- a/frontend/src/components/Search.vue +++ b/frontend/src/components/Search.vue @@ -1,26 +1,12 @@