Create the text index

This commit is contained in:
Las Zenow 2015-01-24 11:53:28 -06:00
parent efcc9cdf8e
commit a1ef113ced

View file

@ -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{