-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Text Search
-
Query Integration
Allow for specifying weights on a non-text field, to be included in the 'score' of text-search. Example input and output:
> db.dropDatabase() { "dropped" : "banana", "ok" : 1 } > use banana switched to db banana > db.c.insert({title: 'How to dress a chicken', popularity: 10}); > db.c.insert({title: 'Keeping chickens cooped up', popularity: 4}); > db.c.insert({title: 'Chicken soup for the left foot', popularity: 15}); > db.c.ensureIndex({'title':'text', popularity: 1}, {weights: { title: 1, popularity: 10} }); > db.runCommand({text:'c', search:'chicken'});
Ideally it would assume that non-text based columns are always 100% match. Some multiplication of the specified weight with the value of the non-text field would then be combined with the text-field weight to create the final answer. The actual method of combining them is likely quite flexible as the user could adjust the popularity base value and weights as needed.
As a rough example:
finalScore = rawScore + popularityWeight * popularity;
(Clearly this would need to be refined as more usage data is collected. This would simply provide a deterministic means to add arbitrary sorting to the results.)
- is related to
-
SERVER-9779 Text search Date awareness
- Backlog