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

Incorrect SCORE when text searching

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL
    • Hide

      Add two simple documents with Url fields to UrlDoc collection.

      Fill Url fields with:

      1. "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/" 2. "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit"

       

      Run query:

      db.getCollection('UrlDoc').find({ $text:

      { $search: "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/" }

      }, { score:

      { $meta: "textScore" }

      }).sort( { score:

      { $meta: "textScore" }

      } )

       

      Show
      Add two simple documents with Url fields to UrlDoc collection. Fill Url fields with: 1. "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/" 2. "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit"   Run query: db.getCollection('UrlDoc').find({ $text: { $search: "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/" } }, { score: { $meta: "textScore" } }).sort( { score: { $meta: "textScore" } } )  

      I am getting the same text search score for two documents.

      Searched phrase is: "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/""

      db.getCollection('UrlDoc').find({ $text:

      { $search: "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/" }

      }, { score:

      { $meta: "textScore" }

      }).sort( { score:

      { $meta: "textScore" }

      } )

      Found two documents with the same score (6) with phrases:

      "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit/""

      "https://docs.mongodb.com/manual/tutorial/avoid-text-index-name-limit"

      As I think, first score should be greater than second.

      See screenshot.

            Assignee:
            eric.sedor@mongodb.com Eric Sedor
            Reporter:
            slawomir.stolcman@lastminute.com Sławomir Stolcman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: