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

Populate new boolean flag in CursorOptions for $searchMeta

    • Query Integration
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Background

      Currently, the server populates `batchSize` in CursorOptions for SearchCommand and GetMore for queries initiated by `$search`. If it is not populated, Mongot will compute scores and read _id for 101 top documents. 

       

      Problem:

      `searchMeta` is used for pure facets results or count, and Mongot doesn't need to do scoring or _id lookup. However, Mongot currently has no indication it's serving a $searchMeta request, so it still retrieves and scores 101 results. Additionally, we have work scheduled for embedded facets where we can improve future user experience for searchMeta queries by accepting simplified syntax.

       

      Solution

      Mongod should indicate to Mongot that it is performing a `$searchMeta` query via a new boolean parameter isMeta/requiresDocs in CursorOptions. This solves both issues: Mongot can accept simplified syntax for embedded facets, but also we can improve performance on existing searchMeta queries by internally running a batchSize of zero (which ordinarily only valid for establishing sharded cursors).

            Assignee:
            finley.lau@mongodb.com Finley Lau
            Reporter:
            evan.darke@mongodb.com Evan Darke
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              None
              None
              None
              None