search a go

This commit is contained in:
Bel LaPointe
2022-02-09 16:27:23 -07:00
parent 9e73818af3
commit 3cbe7e629f
2 changed files with 50 additions and 21 deletions

View File

@@ -325,7 +325,6 @@ func (server *Server) apiV0FilesIDPutHandler(w http.ResponseWriter, r *http.Requ
}
func (server *Server) apiV0SearchHandler(w http.ResponseWriter, r *http.Request) error {
// TODO case insensitive
query := r.URL.Query().Get("q")
queries := strings.Split(query, " ")
if len(queries) == 0 {
@@ -337,7 +336,7 @@ func (server *Server) apiV0SearchHandler(w http.ResponseWriter, r *http.Request)
for _, query := range queries {
if len(query) > 0 {
query = unsafepattern.ReplaceAllString(query, ".")
patterns = append(patterns, regexp.MustCompile(query))
patterns = append(patterns, regexp.MustCompile("(?i)"+query))
}
}
if len(patterns) == 0 {