Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31989

Explain for $text search should include weights

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.10
    • Component/s: Text Search
    • Query Integration

      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.

      "inputStage" : {
      				"stage" : "IXSCAN",
      				"keyPattern" : {
      					"b" : 1
      				},
      				"indexName" : "b_1",
      

      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.

      "inputStage" : {
      				"stage" : "IXSCAN",
      				"keyPattern" : {
      					"_fts" : "text",
      					"_ftsx" : 1
      				},
      				"indexName" : "testName",
      

      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.

            Assignee:
            backlog-query-integration [DO NOT USE] Backlog - Query Integration
            Reporter:
            daniel.hatcher@mongodb.com Danny Hatcher (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: