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>
<title>Factoids</title>
<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>
{{if .EndPoints}}
<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 != "" {
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["Entries"] = entries
context["Search"] = e