[SERVER-85089] User Summary for SERVER-45363 Created: 21/Jan/20  Updated: 12/Jan/24  Resolved: 28/Jan/20

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

Type: Task Priority: Major - P3
Reporter: Ted Tuckman Assignee: Ted Tuckman
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-45363 Issue with mongodb text indexes and w... Closed
Sprint: Query 2020-01-27, Query 2020-02-10
Participants:

 Description   
Issue Status as of Jan 21, 2020

ISSUE SUMMARY
When inserting a document into a collection with a text index, the weight value for each field in that document is reflected in scores stored inside the index key. If the index is a wildcard text index and also has one or more weighted fields, the index will assign an incorrect weight to any field that is lexicographically smaller (alphabetically earlier) than a field with a specified weight. Instead of assigning the default weight, the field will be assigned the weight of the next specified field in the index.

USER IMPACT
Documents in collections with text indexes that have both a wildcard match and a weighted field may have incorrect text scores in the index, and therefore get incorrect scores back projecting or sorting on {$meta: "textScore" }.

RECOVERY STEPS
Dropping and recreating affected text indexes on a version of mongod that includes the patch will fix this issue. This should be done for every wildcard text index with custom weights on specific fields.

AFFECTED VERSIONS
This affects all versions prior to <version-with-fix>.

FIX VERSION
The fix will be included in <version-with-fix>.



 Comments   
Comment by Ted Tuckman [ 27/Jan/20 ]

I've copied the current version over to the server ticket, I'll duplicate any changes that are made from this point forward.

Comment by David Storch [ 23/Jan/20 ]

This LGTM (after I made a few minor edits), with one more piece of feedback:

the field will be assigned the weight of the next specified field in the index

I'm not entirely sure what "next specified field in the index" means. It means the "next field for which a weight is specified in the index definition", right?

Comment by Charlie Swanson [ 23/Jan/20 ]

ted.tuckman LGTM other than the following. I would add a link to the docs for "wildcard text index" and "weighted fields". I imagine some people would be unfamiliar with those terms and wondering if this impacted them.

Comment by Ted Tuckman [ 23/Jan/20 ]

david.storch Good notes. I've made those changes, though if you're alright with it I'd probably remove the example and just leave is as "lexicographically smaller (alphabetically earlier) than ..."

Comment by David Storch [ 22/Jan/20 ]

CC kelsey.schubert, since this is an issue you may want to be aware of.

Comment by David Storch [ 22/Jan/20 ]

Thanks ted.tuckman! Two minor points of feedback:

  1. In the issue summary section, perhaps we could include a brief example to help people understand the "lexicographically smaller" part?
  2. In the recovery steps section, you say "This should be done for every text index". However, this is only needed for text indexes that specify custom weights. Other text indexes are unaffected. Also, does this issue only affect wildcard text indexes with weights or does it affect all text indexes with weights? If it only affects wildcard, then users also need not recreate non-wildcard text indexes.
Generated at Thu Feb 08 06:56:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.