Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-2032

Exported Query object for Search seems to be incorrect.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.4.5
    • None
    • None
    • None
    • 0

    Description

      It seem like some extra text might be being generated in the Java SDK in a FTS (Search query).

      Working on `travel-sample`._default._default with a search index "a" on reviews.content

          SearchQuery dummyQuery = SearchQuery.match("cars");
          SearchOptions options = SearchOptions.searchOptions().limit(5).skip(0).explain(true);
       
          SearchResult result = cluster.searchQuery("a" /* index name is just 'a'*/, dummyQuery, options);
          
          for (SearchRow row : result.rows()) {
          	System.out.println(row);
          }
          
          JsonObject exportObj = dummyQuery.export();
          System.out.println(exportObj);

      I get my expected results but when I export the query it looks funny ...

      .... expected output form for loop .... {"match":"cars","query":{"match":"cars"}}

      The query that the Java SDK generates looks wrong "as in duplicative" with too much info.
       
      I could pass any of the following to the OnPrem UI and get the same results always 40 hits

      {"match":"cars","query":{"match":"cars"}}
      {"match":"cars"}
      {"query":{"match":"cars"}}

      In all cases the UI generates just

      "query": { "match": "cars" }
      

       

      We never see the {"match":"cars","query":{"match":"cars"}} in the UI like we see via the export in the Java SDK is generating.  I think the "match":"cars" above is just an ignored property.

      Note you can run the following curl against an index named "a" it will work

      curl -XPOST -H "Content-Type: application/json" -u admin:passwd http://192.168.3.150:8094/api/index/a/query -d '{
        "query": {
          "match": "cars"
        },
        "size": 10,
        "from": 0
      }'
      

      but the following will fail:

      curl -XPOST -H "Content-Type: application/json" -u admin:jtester http://192.168.3.150:8094/api/index/a/query -d '{
        "match": "cars",
        "size": 10,
        "from": 0
      }'
      

      '

       

      Attachments

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

        Activity

          People

            david.nault David Nault
            jon.strabala Jon Strabala
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty