diff --git a/database/books.go b/database/books.go index 59272a5..4f85980 100644 --- a/database/books.go +++ b/database/books.go @@ -59,7 +59,15 @@ func indexBooks(coll *mgo.Collection) { Key: []string{"active", "-bad_quality", "-_id"}, Background: true, }, - // TODO: there is no weights in mgo + { + Key: []string{"$text:title", "$text:author", "$text:contributor", + "$text:publisher", "$text:subject", "$text:description"}, + Weights: map[string]int{"title": 20, "author": 20, "contributor": 15, + "publisher": 15, "subject": 10, "description": 5}, + + LanguageOverride: "_lang", + Background: true, + }, } for _, k := range []string{"lang", "title", "author", "subject"} { idx := mgo.Index{