Lucene - Core
  1. Lucene - Core
  2. LUCENE-4961

Filters should return null if they don't accept documents

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.3, 4.2.1
    • Fix Version/s: 4.4, 5.0
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      Today we document that Filter#getDocIdSet can return null if it doesn't accept documents. Infact in the code we sometimes return null and sometimes return DocIdSet.EMPTY_DOCIDSET. Conceptually there is nothing wrong with that but apparently we are not applying our optimisations accordingly ie. some parts of the code check for the EMPTY_DOCIDSET and all check for null. this is also a source of potential bugs like in LUCENE-4940 and I think there are still problems in the ToChildBlock query.

      Anyways, I think we should be consistent here about when to apply the optimisations and for the sake of caching in CachingWrapperFilter we should make the EMPTY_DOCIDSET and impl detail.

      1. LUCENE-4961.patch
        32 kB
        Simon Willnauer

        Activity

        Hide
        Simon Willnauer added a comment -

        here is a first patch

        Show
        Simon Willnauer added a comment - here is a first patch
        Hide
        Michael McCandless added a comment -

        +1

        Show
        Michael McCandless added a comment - +1
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] simonw
        http://svn.apache.org/viewvc?view=revision&revision=1476185

        LUCENE-4961: Filters should return null if they don't accept documents

        Show
        Commit Tag Bot added a comment - [trunk commit] simonw http://svn.apache.org/viewvc?view=revision&revision=1476185 LUCENE-4961 : Filters should return null if they don't accept documents
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] simonw
        http://svn.apache.org/viewvc?view=revision&revision=1476210

        LUCENE-4961: Filters should return null if they don't accept documents

        Show
        Commit Tag Bot added a comment - [branch_4x commit] simonw http://svn.apache.org/viewvc?view=revision&revision=1476210 LUCENE-4961 : Filters should return null if they don't accept documents
        Hide
        Uwe Schindler added a comment -

        Thanks! Nice patch!

        Show
        Uwe Schindler added a comment - Thanks! Nice patch!
        Hide
        Steve Rowe added a comment -

        Bulk close resolved 4.4 issues

        Show
        Steve Rowe added a comment - Bulk close resolved 4.4 issues

          People

          • Assignee:
            Simon Willnauer
            Reporter:
            Simon Willnauer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development