Create the text index
This commit is contained in:
parent
efcc9cdf8e
commit
a1ef113ced
1 changed files with 9 additions and 1 deletions
|
@ -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{
|
||||
|
|
Reference in a new issue