Adding a regex to web find

This commit is contained in:
Chris Sexton 2013-06-01 14:34:07 -04:00
parent 38bfc59871
commit b5003e82b5
1 changed files with 1 additions and 1 deletions

View File

@ -467,7 +467,7 @@ func (p *FactoidPlugin) serveQuery(w http.ResponseWriter, r *http.Request) {
context := make(map[string]interface{}) context := make(map[string]interface{})
if e := r.PostFormValue("entry"); e != "" { if e := r.PostFormValue("entry"); e != "" {
var entries []Factoid var entries []Factoid
p.Coll.Find(bson.M{"trigger": e}).All(&entries) p.Coll.Find(bson.M{"trigger": bson.M{"$regex": 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