Fixes #30: Lowercasing the search

This commit is contained in:
Chris Sexton 2014-04-20 21:12:02 -04:00
parent 49939d62c0
commit d298dac814
2 changed files with 2 additions and 1 deletions

View File

@ -247,6 +247,7 @@ var rootIndex string = `
<head> <head>
<title>Factoids</title> <title>Factoids</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.1.0/pure-min.css"> <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.1.0/pure-min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head> </head>
{{if .EndPoints}} {{if .EndPoints}}
<div style="padding-top: 1em;"> <div style="padding-top: 1em;">

View File

@ -517,7 +517,7 @@ func (p *FactoidPlugin) serveQuery(w http.ResponseWriter, r *http.Request) {
} }
if e := r.FormValue("entry"); e != "" { if e := r.FormValue("entry"); e != "" {
var entries []Factoid var entries []Factoid
p.Coll.Find(bson.M{"trigger": bson.M{"$regex": e}}).All(&entries) p.Coll.Find(bson.M{"trigger": bson.M{"$regex": strings.ToLower(e)}}).All(&entries)
context["Count"] = fmt.Sprintf("%d", len(entries)) context["Count"] = fmt.Sprintf("%d", len(entries))
context["Entries"] = entries context["Entries"] = entries
context["Search"] = e context["Search"] = e