Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-51434

Search with N1QL doesn't push down scope into the query: sometimes

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      The two queries should be identical

      Note, I am testing with an FTS index on `travel-sample`.inventory.landmark with a dynamic type mapping on inventory.landmark.

      this is correct

      SELECT /* h.content, */ h.id AS _id, SEARCH_SCORE() AS _score
      FROM `travel-sample`.inventory.landmark AS h
      WHERE SEARCH(h.content, "+paris +notre +dame")
      _id _score
      25933 2.7195699184273776
      21782 1.6599383892495942
      21603 2.5323457161345346
      

      this is incorrect

      SELECT /* h.content, */ h.id AS _id, SEARCH_SCORE() AS _score
      FROM `travel-sample`.inventory.landmark AS h
      WHERE SEARCH(h.content, {"query": "+paris +notre +dame"})
      ORDER BY _score DESC
      _id _score
      21603 1.7580958760961103
      21752 1.6636198923208063
      21867 1.5309311435541715
      21864 1.2123922761691992
      21782 1.0390219329977914
      25933 1.0103269228837675
      21688 0.8761105647604155
      21788 0.706441693239785
      

      both should operate like the following curl payload
      {
      "explain": false,
      "fields": [
      "*"
      ],
      "highlight": {},
      "query": {
      "query": "+content:paris +content:notre +content:dame"
      },
      "size": 10,
      "from": 0,
      "sort": [
      "-_score"
      ]
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          This event occurs when the user passes in a query string query as an object - which is NOT parsed into a boolean query (which a query string otherwise is) and therefore isn't treated as a "field-able" query - because of which the field is NOT scoped to the search criteria. 

          Perhaps worth fixing in n1fty.

          abhinav Abhi Dangeti added a comment - This event occurs when the user passes in a query string query as an object - which is NOT parsed into a boolean query (which a query string otherwise is) and therefore isn't treated as a "field-able" query - because of which the field is NOT scoped to the search criteria.  Perhaps worth fixing in n1fty.

          https://review.couchbase.org/c/n1fty/+/172216

          Wayne Siu Girish Benakappa Worth fixing in Neo, please weight in on this.

          abhinav Abhi Dangeti added a comment - https://review.couchbase.org/c/n1fty/+/172216 Wayne Siu Girish Benakappa Worth fixing in Neo, please weight in on this.

          Build couchbase-server-7.1.0-2487 contains n1fty commit 340c359 with commit message:
          MB-51434: Fix field scope when query string query fed in as object

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.1.0-2487 contains n1fty commit 340c359 with commit message: MB-51434 : Fix field scope when query string query fed in as object

          Verified with 7.1.0 build 2487

          girish.benakappa Girish Benakappa added a comment - Verified with 7.1.0 build 2487

          Build couchbase-server-7.2.0-1016 contains n1fty commit 340c359 with commit message:
          MB-51434: Fix field scope when query string query fed in as object

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.2.0-1016 contains n1fty commit 340c359 with commit message: MB-51434 : Fix field scope when query string query fed in as object

          People

            girish.benakappa Girish Benakappa
            jon.strabala Jon Strabala
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty