[SERVER-31989] Explain for $text search should include weights Created: 15/Nov/17 Updated: 27/Dec/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Text Search |
| Affects Version/s: | 3.4.10 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Danny Hatcher (Inactive) | Assignee: | Backlog - Query Integration |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | qi-text-search | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Assigned Teams: |
Query Integration
|
||||
| Participants: | |||||
| Case: | (copied to CRM) | ||||
| Description |
|
Most indexes have the indexed fields in the key document. Explain against these indexes will list the relevant fields in the keyPattern document. These fields can be used to help diagnose long-running queries.
Instead of the indexed fields themselves, text indexes use "_fts" : "text" and _ftsx" : 1 in the key document. Thus, when running explain against these queries, it is impossible to tell what fields are in the index unless the default indexName is used.
As the indexed fields will be represented in the weights document, adding the document to the explain output should accomplish the same effect as standard indexes. |
| Comments |
| Comment by Kyle Suarez [ 16/Nov/17 ] | |||||||||||||||||||||||||||||||||
|
Oops. I ran the listIndexes command, which includes the weights document; however on running an explain of a find with a $text search query it indeed does not include the weights. Thanks for explaining, daniel.hatcher! Throwing this into Query Team Triage. | |||||||||||||||||||||||||||||||||
| Comment by Kyle Suarez [ 16/Nov/17 ] | |||||||||||||||||||||||||||||||||
|
It looks like v3 text indexes in MongoDB 3.6 include this information:
I'm not sure what change introduced this, but if it isn't present in 3.4 we could consider backporting it depending on the complexity of the change. |