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

[Analytics] analytics array query gives wrong results

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 6.0.3
    • 6.0.3
    • analytics
    • 6.0.3-2870
    • Untriaged
    • Unknown
    • CX Sprint 167

    Description

      Load travel-sample
      Create dataverse on travel-sample
      Connect link local

      Run this query:
      SELECT id, url, title, name, country, address, city FROM `travel-sample` t WHERE (ANY r IN t.reviews SATISFIES r.date like "2012-01-14 02:15:51 +03%" END) AND `type` = "hotel" ORDER BY id, url, title, name, country, address, city

      It will return zero results, however if you run the same query with n1ql(with an appropriate index)

      CREATE INDEX `adv_DISTINCT_reviews_date_type_id_url_title_name_country_address_city` ON `travel-sample`((distinct (array (`r`.`date`) for `r` in `reviews` end)),`id`,`url`,`title`,`name`,`country`,`address`,`city`) WHERE (`type` = "hotel")

      SELECT id, url, title, name, country, address, city FROM `travel-sample` WHERE ANY r IN reviews SATISFIES r.date like "2012-01-14 02:15:51 +03%" END AND `type` = "hotel" ORDER BY id, url, title, name, country, address, city

      It correctly returns 1 result:
      [

      { "address": "6 rue aux Juifs", "city": "Giverny", "country": "France", "id": 10063, "name": "The Robins", "title": "Giverny", "url": "http://givernyguesthouse.com/robin.htm" }

      ]

      If we look at the rest of this document we see the reviews section does contain an appropriate entry for the above query:

      {
      "author": "Nedra Cronin",
      "content": "We ended up choosing the Holiday Inn because it had a combination of a low price and a really convenient location. It's close to some great restaurants and just far enough from Bourbon street so that it isn't noisy. The indoor pool on the 10th floor was nice, too. No complaints here.",
      "date": "2012-01-14 02:15:51 +0300",
      "ratings":

      { "Overall": 4 }

      },

      Attaching logs, analytics node is .173

      Attachments

        Issue Links

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

          Activity

            People

              mihir.kamdar Mihir Kamdar (Inactive)
              ajay.bhullar Ajay Bhullar
              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