Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-703

Change QueryParser to use ConstantScoreRangeQuery in preference to RangeQuery by default

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: core/queryparser
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      Change to QueryParser to default to using new ConstantScoreRangeQuery in preference to RangeQuery
      for range queries. This implementation is generally preferable because it
      a) Runs faster
      b) Does not have the scarcity of range terms unduly influence score
      c) avoids any "TooManyBooleanClauses" exception.

      However, if applications really need to use the old-fashioned RangeQuery and the above
      points are not required then the "useOldRangeQuery" property can be used to revert to old behaviour.

      The patch includes extra Junit tests for this flag and all other Junit tests pass

      1. patch.diff
        5 kB
        Mark Harwood

        Activity

        Hide
        markh Mark Harwood added a comment -

        So two +1s for this patch and no objections so far.

        Last call - if there's no more comments I'll commit this later.

        Show
        markh Mark Harwood added a comment - So two +1s for this patch and no objections so far. Last call - if there's no more comments I'll commit this later.
        Hide
        otis Otis Gospodnetic added a comment -

        I'm too tired to look at the patch, but I am +1 for this change in principal. Voted for it in JIRA, too.

        Show
        otis Otis Gospodnetic added a comment - I'm too tired to look at the patch, but I am +1 for this change in principal. Voted for it in JIRA, too.
        Hide
        hossman Hoss Man added a comment -

        If we're going to do this, do we want to add support for "*" like SolrQueryParser has...

        https://svn.apache.org/viewvc/incubator/solr/trunk/src/java/org/apache/solr/search/SolrQueryParser.java?view=markup

        ie...

        fieldName:[a TO *]
        fieldName:[* TO z]

        Show
        hossman Hoss Man added a comment - If we're going to do this, do we want to add support for "*" like SolrQueryParser has... https://svn.apache.org/viewvc/incubator/solr/trunk/src/java/org/apache/solr/search/SolrQueryParser.java?view=markup ie... fieldName: [a TO *] fieldName: [* TO z]
        Hide
        markh Mark Harwood added a comment -

        In my opinion the positives of this change outweigh the negatives but is it worth consulting the java-user mailing list and canvassing opinion before committing?

        Show
        markh Mark Harwood added a comment - In my opinion the positives of this change outweigh the negatives but is it worth consulting the java-user mailing list and canvassing opinion before committing?
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        Looks OK to me.... Solr has had this from the start, but it was unclear if Lucene folks wanted to break scoring backward compatibility (including disabling index-time boosts).

        Show
        yseeley@gmail.com Yonik Seeley added a comment - Looks OK to me.... Solr has had this from the start, but it was unclear if Lucene folks wanted to break scoring backward compatibility (including disabling index-time boosts).
        Hide
        markh Mark Harwood added a comment -

        Change to QueryParser and associated JUnit test

        Show
        markh Mark Harwood added a comment - Change to QueryParser and associated JUnit test

          People

          • Assignee:
            Unassigned
            Reporter:
            markh Mark Harwood
          • Votes:
            3 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development