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

RangeFieldQuery optimization for "all docs match" is broken

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0, 6.6
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      RangeFieldQuery tries to detect based on the min/max values of the field whether all values match. However this detection is broken and can sometimes consider that all documents match when they actually don't.

      1. LUCENE-7847.patch
        12 kB
        Adrien Grand
      2. LUCENE-7847.patch
        4 kB
        Adrien Grand

        Issue Links

          Activity

          Hide
          jpountz Adrien Grand added a comment -

          I found this while digging LUCENE-7807. Here is a patch but I'm still looking for ways to make tests more likely to expose such issues. Separately I tend to find it hard to reason about all possible range types in the compare logic. I think it'd be easier to read if we had a separate method for each query type?

          Show
          jpountz Adrien Grand added a comment - I found this while digging LUCENE-7807 . Here is a patch but I'm still looking for ways to make tests more likely to expose such issues. Separately I tend to find it hard to reason about all possible range types in the compare logic. I think it'd be easier to read if we had a separate method for each query type?
          Hide
          jpountz Adrien Grand added a comment -

          Here is an updated patch. I make the tiny case run multiple times since it is cheap, and changed random value generation so that it is more likely to trigger "interesting" cases, such as a query range that is equal to the indexed range. This found a test bug in the ip range test, which used Object.equals instead of Arrays.equals to compate two byte[].

          Show
          jpountz Adrien Grand added a comment - Here is an updated patch. I make the tiny case run multiple times since it is cheap, and changed random value generation so that it is more likely to trigger "interesting" cases, such as a query range that is equal to the indexed range. This found a test bug in the ip range test, which used Object.equals instead of Arrays.equals to compate two byte[] .
          Hide
          nknize Nicholas Knize added a comment -

          +1
          Love the simplicity of the scorer and thanks for making the test more evil!

          Show
          nknize Nicholas Knize added a comment - +1 Love the simplicity of the scorer and thanks for making the test more evil!
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 5de10a64b1e6e584640e6a7fdb1bbd1ba7e766d7 in lucene-solr's branch refs/heads/branch_6_6 from Adrien Grand
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=5de10a6 ]

          LUCENE-7847: Fix the all-docs-match optimization of range queries on range fields.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 5de10a64b1e6e584640e6a7fdb1bbd1ba7e766d7 in lucene-solr's branch refs/heads/branch_6_6 from Adrien Grand [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=5de10a6 ] LUCENE-7847 : Fix the all-docs-match optimization of range queries on range fields.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8db5e5acfae2335a63c3f845158fbcc6d9471677 in lucene-solr's branch refs/heads/branch_6x from Adrien Grand
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8db5e5a ]

          LUCENE-7847: Fix the all-docs-match optimization of range queries on range fields.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8db5e5acfae2335a63c3f845158fbcc6d9471677 in lucene-solr's branch refs/heads/branch_6x from Adrien Grand [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8db5e5a ] LUCENE-7847 : Fix the all-docs-match optimization of range queries on range fields.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 14320a584c7771c63fba4de868c51ee9a5cf06de in lucene-solr's branch refs/heads/master from Adrien Grand
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=14320a5 ]

          LUCENE-7847: Fix the all-docs-match optimization of range queries on range fields.

          Show
          jira-bot ASF subversion and git services added a comment - Commit 14320a584c7771c63fba4de868c51ee9a5cf06de in lucene-solr's branch refs/heads/master from Adrien Grand [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=14320a5 ] LUCENE-7847 : Fix the all-docs-match optimization of range queries on range fields.

            People

            • Assignee:
              Unassigned
              Reporter:
              jpountz Adrien Grand
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development