Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-12096

Inconsistent response format in subquery transform

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 7.4
    • None
    • None

    Description

      Solr version - 6.6.2
      The response of subquery transform is inconsistent with multi-shard compared to single-shard

      Single Shard collection

      Request

      localhost:8983/solr/k_test/search?sort=score desc,uniqueId desc&q.op=AND&wt=json&q={!parent which=parent_field:true score=max}({!edismax v=$origQuery})&facet=false&fl=uniqueId&fl=score&fl=_children_:[subquery]&fl=uniqueId&origQuery=false&qf=parent_field&_children_.fl=uniqueId&_children_.fl=score&_children_.rows=3&spellcheck=false&_children_.q={!edismax qf=parentId v=$row.uniqueId}&rows=1
      

      Response for above request

      {
          "responseHeader": {
              "zkConnected": true,
              "status": 0,
              "QTime": 0,
              "params": {
                  "fl": [
                      "uniqueId",
                      "score",
                      "_children_:[subquery]",
                      "uniqueId"
                  ],
                  "origQuery": "false",
                  "q.op": "AND",
                  "_children_.rows": "3",
                  "sort": "score desc,uniqueId desc",
                  "rows": "1",
                  "q": "{!parent which=parent_field:true score=max}({!edismax v=$origQuery})",
                  "qf": "parent_field",
                  "spellcheck": "false",
                  "_children_.q": "{!edismax qf=parentId v=$row.uniqueId}",
                  "_children_.fl": [
                      "uniqueId",
                      "score"
                  ],
                  "wt": "json",
                  "facet": "false"
              }
          },
          "response": {
              "numFound": 1,
              "start": 0,
              "maxScore": 0.5,
              "docs": [
                  {
                      "uniqueId": "10001677",
                      "score": 0.5,
                      "_children_": {
                          "numFound": 9,
                          "start": 0,
                          "docs": [
                              {
                                  "uniqueId": "100016771",
                                  "score": 0.5
                              },
                              {
                                  "uniqueId": "100016772",
                                  "score": 0.5
                              },
                              {
                                  "uniqueId": "100016773",
                                  "score": 0.5
                              }
                          ]
                      }
                  }
              ]
          }
      }
      

      Here, children suquery response is as expected (Based on documentation)

      Multi Shard collection(2)

      Request

      localhost:8983/solr/k_test_2/search?sort=score desc,uniqueId desc&q.op=AND&wt=json&q={!parent which=parent_field:true score=max}({!edismax v=$origQuery})&facet=false&fl=uniqueId&fl=score&fl=_children_:[subquery]&fl=uniqueId&origQuery=false&qf=parent_field&_children_.fl=uniqueId&_children_.fl=score&_children_.rows=3&spellcheck=false&_children_.q={!edismax qf=parentId v=$row.uniqueId}&rows=1
      

      Response

      {
          "responseHeader": {
              "zkConnected": true,
              "status": 0,
              "QTime": 11,
              "params": {
                  "fl": [
                      "uniqueId",
                      "score",
                      "_children_:[subquery]",
                      "uniqueId"
                  ],
                  "origQuery": "false",
                  "q.op": "AND",
                  "_children_.rows": "3",
                  "sort": "score desc,uniqueId desc",
                  "rows": "1",
                  "q": "{!parent which=parent_field:true score=max}({!edismax v=$origQuery})",
                  "qf": "parent_field",
                  "spellcheck": "false",
                  "_children_.q": "{!edismax qf=parentId v=$row.uniqueId}",
                  "_children_.fl": [
                      "uniqueId",
                      "score"
                  ],
                  "wt": "json",
                  "facet": "false"
              }
          },
          "response": {
              "numFound": 5,
              "start": 0,
              "maxScore": 0.5,
              "docs": [
                  {
                      "uniqueId": "10006197",
                      "_children_": [
                          {
                              "uniqueId": "100061971",
                              "score": 0.5
                          },
                          {
                              "uniqueId": "100061972",
                              "score": 0.5
                          },
                          {
                              "uniqueId": "100061973",
                              "score": 0.5
                          }
                      ],
                      "score": 0.5
                  }
              ]
          }
      }
      

      As you can see, children subquery response is a list instead of Map

      Attachments

        1. SOLR-12096.patch
          1 kB
          Munendra S N
        2. SOLR-12096.patch
          2 kB
          Munendra S N
        3. SOLR-12096.patch
          5 kB
          Munendra S N
        4. SOLR-12096.patch
          5 kB
          Munendra S N
        5. SOLR-12096.testsubquery.patch
          4 kB
          Mikhail Khludnev
        6. SOLR-12096.patch
          10 kB
          Munendra S N
        7. remove_needless_JSON_response_writing_special_case_for_List.patch
          3 kB
          David Smiley

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ichattopadhyaya Ishan Chattopadhyaya
            munendrasn Munendra S N
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment