Solr
  1. Solr
  2. SOLR-2275

Spaces around mm parameter in dismax configuration cause NumberFormatException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 4.0-ALPHA
    • Component/s: Schema and Analysis
    • Labels:
      None

      Description

      Any whitespace around simple mm parameters in the configuration file produces a NumberFormatException at SolrPluginUtils.java:625. E.g. <str> 2 <str>. Adding whitespace in tests also causes this error to occur.

      1. SOLR-2275_optimize.patch
        2 kB
        Yonik Seeley
      2. SOLR-2275.patch
        5 kB
        Erick Erickson
      3. SOLR-2275-3_x.patch
        4 kB
        Erick Erickson

        Activity

        Hide
        Erick Erickson added a comment -

        If someone wants to assign this to me (Erick Erickson), I'll fix it this weekend. And can someone see if there's a way that I can take JIRA issues for myself?

        Show
        Erick Erickson added a comment - If someone wants to assign this to me (Erick Erickson), I'll fix it this weekend. And can someone see if there's a way that I can take JIRA issues for myself?
        Hide
        Yonik Seeley added a comment -

        I just added you as a "contributor" to JIRA... hopefully that should do the trick. Can you try again?

        Show
        Yonik Seeley added a comment - I just added you as a "contributor" to JIRA... hopefully that should do the trick. Can you try again?
        Hide
        Erick Erickson added a comment -

        Thanks, Yonik, that worked.

        Show
        Erick Erickson added a comment - Thanks, Yonik, that worked.
        Hide
        Erick Erickson added a comment -

        I've attached a patch for this issue. It may be a little bit of overkill, but it handles random whitespace in various expressions, I've updated the tests by adding spaces around various expressions. For instance, " 3 < -25% 10 < -3\n", " \n-25%\n ", " \n3\n ".

        Let me know if there are changes you'd like to see...

        Show
        Erick Erickson added a comment - I've attached a patch for this issue. It may be a little bit of overkill, but it handles random whitespace in various expressions, I've updated the tests by adding spaces around various expressions. For instance, " 3 < -25% 10 < -3\n", " \n-25%\n ", " \n3\n ". Let me know if there are changes you'd like to see...
        Hide
        Erick Erickson added a comment -

        Here's the patch, see previous comment.

        Show
        Erick Erickson added a comment - Here's the patch, see previous comment.
        Hide
        Erick Erickson added a comment -

        Anybody want to pick this up and commit it?

        Show
        Erick Erickson added a comment - Anybody want to pick this up and commit it?
        Hide
        Hoss Man added a comment -

        Committed revision 1051641. - trunk

        Show
        Hoss Man added a comment - Committed revision 1051641. - trunk
        Hide
        Hoss Man added a comment -

        Thanks Erick,

        I committed to trunk ... the patch didn't merge cleanly to 3x, so i left it alone for now. it would be nice to backport, but i can't tackle it just right now.

        Show
        Hoss Man added a comment - Thanks Erick, I committed to trunk ... the patch didn't merge cleanly to 3x, so i left it alone for now. it would be nice to backport, but i can't tackle it just right now.
        Hide
        Erick Erickson added a comment -

        Hoss:

        Thanks for committing the trunk, here's the patch for the current (22-Dec) 3_x branch. It's ready to apply as far as I can tell. All tests pass.

        Show
        Erick Erickson added a comment - Hoss: Thanks for committing the trunk, here's the patch for the current (22-Dec) 3_x branch. It's ready to apply as far as I can tell. All tests pass.
        Hide
        Yonik Seeley added a comment -

        Here's a patch to optimize the mm parsing code a bit (I happened to be looking at the code because of this patch).
        I did little things like pre-compile patterns, changed the space-around-lessthan pattern to only match if there are spaces to be removed, moved that pattern inside the case where '<' was detected, moved to Integer.parseInt, etc.

        Show
        Yonik Seeley added a comment - Here's a patch to optimize the mm parsing code a bit (I happened to be looking at the code because of this patch). I did little things like pre-compile patterns, changed the space-around-lessthan pattern to only match if there are spaces to be removed, moved that pattern inside the case where '<' was detected, moved to Integer.parseInt, etc.

          People

          • Assignee:
            Erick Erickson
            Reporter:
            Erick Erickson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 2h
              2h
              Remaining:
              Remaining Estimate - 2h
              2h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development