summary refs log tree commit diff stats
path: root/handlers.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-22 02:50:34 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-22 03:21:29 -0400
commit37bf8b04e76ea1cce678238af48ac8097348e655 (patch)
tree5b3e2e38435fc3f51f2ee55a5684d4a31ce4b56b /handlers.go
parent29c35a301b66f0bc7fe2fb102ac2548ca9b522c9 (diff)
downloadgetwtxt-37bf8b04e76ea1cce678238af48ac8097348e655.tar.gz
tuning query handling
Diffstat (limited to 'handlers.go')
-rw-r--r--handlers.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/handlers.go b/handlers.go
index 947c96a..9dc7192 100644
--- a/handlers.go
+++ b/handlers.go
@@ -136,25 +136,20 @@ func apiTagsHandler(w http.ResponseWriter, r *http.Request) {
 	vars := mux.Vars(r)
 	tags := vars["tags"]
 
-	out, err := twtxtCache.QueryInStatus("#" + tags)
-	if err != nil {
-		log500(w, r, err)
-		return
-	}
 	tags = strings.ToLower(tags)
-	out2, err := twtxtCache.QueryInStatus("#" + tags)
+	out, err := twtxtCache.QueryInStatus("#" + tags)
 	if err != nil {
 		log500(w, r, err)
 		return
 	}
 	tags = strings.Title(tags)
-	out3, err := twtxtCache.QueryInStatus("#" + tags)
+	out2, err := twtxtCache.QueryInStatus("#" + tags)
 	if err != nil {
 		log500(w, r, err)
 		return
 	}
 	tags = strings.ToUpper(tags)
-	out4, err := twtxtCache.QueryInStatus("#" + tags)
+	out3, err := twtxtCache.QueryInStatus("#" + tags)
 	if err != nil {
 		log500(w, r, err)
 		return
@@ -162,7 +157,7 @@ func apiTagsHandler(w http.ResponseWriter, r *http.Request) {
 
 	out = append(out, out2...)
 	out = append(out, out3...)
-	out = append(out, out4...)
+	out = uniq(out)
 
 	data := parseQueryOut(out)