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

Use text search suffix field predicates to limit index scan

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Querying, Text Search
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible

      Description

      To set the terminology:

      In the following index description

      {a: 1, b: 1, c: "text", d: 1, e: 1}

      the text index prefix is {a: 1, b: 1} and the text index suffix is {d: 1, e: 1}.

      Predicates over the fields in the text index suffix are not used to constrain the number of documents index-scanned during a full-text search.

      For example consider a collection where the search predicate

      {a: 123, b: 456, $text: {$search: 'foo bar'}} 

      would find 30 documents, and

      {a: 123, b: 456, $text: {$search: 'foo bar'}, d: {$gte: 0}} 

      would find only 10 documents.

      During the second query the query optimizer does not use the 'd' predicate to avoid scanning the other 20 documents during the query execution. The "nscanned" value will be 30 for both, even though "n" is different.

        Attachments

          Activity

            People

            Assignee:
            backlog-server-query Backlog - Query Team
            Reporter:
            akira.kurogane Akira Kurogane
            Participants:
            Votes:
            2 Vote for this issue
            Watchers:
            13 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: