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

UI fails to return field array if also highlighting

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      Using travel-sample is I index reviews.content and if I do a query either on "highlight": {} or on "fields": ["reviews.content"] things work correctly.

      But if I do both "highlight": {} and "fields": ["reviews.content"]  only the "highlight" is emitted in the UI and the array of matches form "fields" is suppressed.

      The UI only returns one item (the highlight) per each matching doc - but the REST API emits both the (single) highlight and also the array of fields per each matching doc .

      The query I used

      {
        "explain": true,
        "fields": [
          "reviews.content"
        ],
        "highlight": {},
        "query": {
          "match_phrase": "streetcar"
        },
        "size": 10,
        "from": 0
      }

      I think this happens because both the fragment and the fields map into the same key in the UI's JavaScript code when rendering the results for the UI, the behavior may actually be by design, since highlighting only returns and highlights one of the match items (if there is more than one match).

      However the UI and the REST API really should provide the same information. 

      Perhaps the highlight should display as a one item JSON array in the UI note the prepend with "fragments."

      fragments.reviews.content: [ 
      "â¦..... <mark>streetcar</mark> .....â¦"
      ]
      

      and the fields as an N item array

      reviews.content: [ 
      <match1>,
      <match1>,
      .....
      <matchN>
      ]
      

       

       

      Attachments

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

        Activity

          People

            likith.b Likith B
            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