Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core/other
    • Labels:
      None
    • Environment:

      all

    • Lucene Fields:
      New

      Description

      The returned value from solrParams.get( key ) depends on the implementing class such that:

      modifiableParams = new ModifiableSolrParams( req.getParams() );
      assert modifiableParams.get("key").equals( req.getParams().get("key") );
      

      fails for requests built from a SimpleRequestParser or StandardRequestParser where the parameter "key" was given, but empty ( e.g. localhost:8393/select/?key=&para1=val1&parm2=val2 ).

      The reason is that oas.request.ServletSolrParams returns null for values with length() == 0,
      but all other SolrParams implementations return the empty String.

      This behaviour has also side effects on search components:
      Most, if not all, standard search components check for something like

      if (reg.getParams().getBool(myTriggerParameter, false) )

      { ...do what I am supposed to do... }

      In case of ServletSolrParams getBool() returns the desired and expected "false", all other Implementations throw a "bad request" Exception.
      One may argue that suppling a parameter with an empty value indeed is a malformed request, ...

      Nonetheless I think, the above mentioned equality check should hold true for any request and any SolrParams.

      Because I cannot oversee the implications, I currently don't have a better suggestion to achieve this, than
      to make ServleSolrParams also return the empty String, which is in my opinion counter-intuitive and does not the right thing for the getBool(), getInt() etc. cases.

        Activity

        Hide
        Frank Wesemann added a comment -

        Chris Hostetter already comment on the mailing list:

        : this test fails for requests built from a SimpleRequestParser or
        : StandardRequestParser where the parameter "key" was given, but empty ( e.g.
        : localhost:8393/select/?key=&para1=val1&parm2=val2 ).
        :
        : The reason is that oas.request.ServletSolrParams returns null for values with
        : length() == 0,
        : but all other SolrParams implementations return the empty String.

        Hmmm, can you please open a bug for this?

        : In case of ServletSolrParams getBool() returns the desired and expected
        : "false",
        : all other Implementations throw a "bad request" Exception.
        : One may argue that suppling a parameter with an empty value indeed is a
        : malformed request,

        that would be my off the cuff opinion – It seems like ServletSolrParams
        is the one with the bug since it isn't correctly retunring the empty
        string that was specified by the user (in the case of booleans this may be
        handy, but for other params the ineability to specify an empty string to
        override the default value could be problematic (ie: if you want
        highlighter fragments but you want blank pre/post markup)

        : Because I cannot oversee the implications, I currently don't have a better
        : suggestion to achieve this, than
        : to make ServleSolrParams also return the empty String, which is in my opinion
        : counter-intuitive and does not the right thing for the getBool(), getInt()

        there may be ways to address these in particular: treating the empty
        string as equivilent to null in the type specific parsing code, but i also
        haven't through it through all the way.

        -Hoss

        Show
        Frank Wesemann added a comment - Chris Hostetter already comment on the mailing list: : this test fails for requests built from a SimpleRequestParser or : StandardRequestParser where the parameter "key" was given, but empty ( e.g. : localhost:8393/select/?key=&para1=val1&parm2=val2 ). : : The reason is that oas.request.ServletSolrParams returns null for values with : length() == 0, : but all other SolrParams implementations return the empty String. Hmmm, can you please open a bug for this? : In case of ServletSolrParams getBool() returns the desired and expected : "false", : all other Implementations throw a "bad request" Exception. : One may argue that suppling a parameter with an empty value indeed is a : malformed request, that would be my off the cuff opinion – It seems like ServletSolrParams is the one with the bug since it isn't correctly retunring the empty string that was specified by the user (in the case of booleans this may be handy, but for other params the ineability to specify an empty string to override the default value could be problematic (ie: if you want highlighter fragments but you want blank pre/post markup) : Because I cannot oversee the implications, I currently don't have a better : suggestion to achieve this, than : to make ServleSolrParams also return the empty String, which is in my opinion : counter-intuitive and does not the right thing for the getBool(), getInt() there may be ways to address these in particular: treating the empty string as equivilent to null in the type specific parsing code, but i also haven't through it through all the way. -Hoss
        Hide
        Mark Miller added a comment -

        This should be in the Solr JIRA, not Lucene

        Show
        Mark Miller added a comment - This should be in the Solr JIRA, not Lucene

          People

          • Assignee:
            Unassigned
            Reporter:
            Frank Wesemann
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development