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

Macros in appends/invariants parameters not getting expanded in Solrcloud

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

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 7.6, 8.6.3
    • Fix Version/s: None
    • Component/s: SolrCloud
    • Labels:
      None

      Description

      Macros in a request handler's appends or invariants parameter sets are not getting expanded when running in a SolrCloud setup.

      In my case, I have a handler like the following:

      <requestHandler name="/myhandler" class="solr.SearchHandler">
        <lst name="defaults">
          <str name="q">some_field:"$${my_term}"</str>
          <str name="fl">term_defaults:'$${my_term},freq_defaults:docfreq(some_field, '$${my_term}')</str>
        </lst>
        <lst name="appends">
          <str name="fl">term_appends:'$${my_term}',freq_appends:docfreq(some_field, '$${my_term}')</str>
        </lst>
      </requestHandler>
      

      When querying the handler with `?my_term=foobar&echoParams=all`, something like this is the result:

      {
          "response": {
              "docs": [
                  {
                      "term_defaults": "foobar",
                      "term_appends": "${my_term}",
                      "freq_appends": 0,
                      "freq_defaults": 1
                  }
              ],
              "maxScore": 13.244947,
              "numFound": 1,
              "start": 0
          },
          "responseHeader": {
              "QTime": 262091,
              "params": {
                  "echoParams": "all",
                  "fl": [
                      "term_defaults:'foobar',freq_defaults:docfreq(some_field, 'foobar')",
                      "term_appends:'foobar',freq_appends:docfreq(some_field, 'foobar')"
                  ],
                  "my_term": "foobar",
                  "q": "some_field:\"foobar\"",
                  "rows": "1"
              },
              "status": 0,
              "zkConnected": true
          }
      }
      

      As you can see, the macro in the appends fl parameter gets expanded in the responseHeader.params.fl field, but not in the actual document.

      I believe the reason for this is the following:

      I think the easy/obvious fix for this would be not to set defaults/invariants/appends parameters twice, i.e. disable it when isShard=true, just like macro expansion, but I don't have the full picture if that might not break something else.

      Here's the Twitter thread where I rubber-ducked through this issue: https://twitter.com/jbaiter_/status/1316023733576843272

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jbaiter Johannes Baiter

              Dates

              • Created:
                Updated:

                Issue deployment