+1
-1
@@ -44,7 +44,7 @@ func makeLogID(date time.Time, channel string) string {
|
|||||||
func init() {
|
func init() {
|
||||||
store.HandleInit(func(db *mgo.Database) {
|
store.HandleInit(func(db *mgo.Database) {
|
||||||
collection = db.C("logbot3.logs")
|
collection = db.C("logbot3.logs")
|
||||||
postCollection = db.C("logbo3.posts")
|
postCollection = db.C("logbot3.posts")
|
||||||
|
|
||||||
collection.EnsureIndexKey("date")
|
collection.EnsureIndexKey("date")
|
||||||
collection.EnsureIndexKey("channel")
|
collection.EnsureIndexKey("channel")
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ func search(text string) ([]string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ids := make([]string, 0, 64)
|
ids := make([]string, 0, 64)
|
||||||
err := postCollection.Find(query).Distinct("logId", ids)
|
err := postCollection.Find(query).Distinct("logId", &ids)
|
||||||
|
|
||||||
return ids, err
|
return ids, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user