[SERVER-44124] Incorrect SCORE when text searching Created: 21/Oct/19  Updated: 25/Oct/19  Resolved: 25/Oct/19

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sławomir Stolcman Assignee: Eric Sedor
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File textscore.png    
Operating System: ALL
Steps To Reproduce:

Add two simple documents with Url fields to UrlDoc collection.

Fill Url fields with:

1. "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/" 2. "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit"

 

Run query:

db.getCollection('UrlDoc').find({ $text:

{ $search: "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/" }

}, { score:

{ $meta: "textScore" }

}).sort( { score:

{ $meta: "textScore" }

} )

 

Participants:

 Description   

I am getting the same text search score for two documents.

Searched phrase is: "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/""

db.getCollection('UrlDoc').find({ $text:

{ $search: "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/" }

}, { score:

{ $meta: "textScore" }

}).sort( { score:

{ $meta: "textScore" }

} )

Found two documents with the same score (6) with phrases:

"https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/""

"https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit"

As I think, first score should be greater than second.

See screenshot.



 Comments   
Comment by Eric Sedor [ 25/Oct/19 ]

Hello,

Most punctuation marks are treated as a tokenization delimiters.

For assistance understanding how text search scores are computed, I encourage you to search or post on our community mongodb-user group, or on Stack Overflow with the mongodb tag. If you have reason to suspect a bug or have a specific feature request, we'd be happy to consider it here.

Gratefully,
Eric

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