[SERVER-9664] Allow non-text columns to influence the text search score for sorting Created: 13/May/13  Updated: 28/Dec/23

Status: Backlog
Project: Core Server
Component/s: Text Search
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Will Shaver Assignee: Backlog - Query Integration
Resolution: Unresolved Votes: 0
Labels: qi-text-search
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-9779 Text search Date awareness Backlog
Assigned Teams:
Query Integration
Participants:

 Description   

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.)



 Comments   
Comment by Will Shaver [ 13/May/13 ]

So in the example above, ideally "Chicken soup for the left foot" would be ranked higher than the other results as it has a much higher popularity, and popularity is 10x more important than the full-text results.

Comment by Will Shaver [ 13/May/13 ]

Doh. Meant to not post it as a 'bug', but can't edit it now.

Generated at Thu Feb 08 03:21:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.