[
https://issues.apache.org/jira/browse/LUCENE-5495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13925516#comment-13925516
]
Uwe Schindler commented on LUCENE-5495:
---------------------------------------
bq. Some Filter implementations produce DocIdSets without the iterator()
implementation, such as o.a.l.facet.range.Range.getFilter().
The Lucene contract requires that every filter implements iterator() in the
DocIdSet. So the bug is in that filter. If it does not implement iterator(), it
is the non-matching filter. The bits() call is only used as an addon to improve
performance. - Which filters do this?
E.g., FilteredQuery first gets the DocIdSetIteraor and only if it is not null,
it eventually uses bits(). But if its null, it returns no scorer. In your patch
the logic is the other way round.
We might improve BooleanFilter to use bits() if available, but the contract
must be respected.
bq. if bits is already a FixedBitSet or OpenBitSet, merge them into res might
be faster? same for other lists (Not necessary, please drop this one)
This is already done (not easy visible to the reader of the code), because
{{FixedBitSet.or(disi)}} (and others) shortcut for iterators from other
FixedBitSets.
> Boolean Filter does not handle FilterClauses with only bits() implemented
> -------------------------------------------------------------------------
>
> Key: LUCENE-5495
> URL: https://issues.apache.org/jira/browse/LUCENE-5495
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/search
> Affects Versions: 4.6.1
> Reporter: John Wang
> Attachments: LUCENE-5495.patch, LUCENE-5495.patch
>
>
> Some Filter implementations produce DocIdSets without the iterator()
> implementation, such as o.a.l.facet.range.Range.getFilter().
> Currently, such filters cannot be added to a BooleanFilter because
> BooleanFilter expects all FilterClauses with Filters that have iterator()
> implemented.
> This patch improves the behavior by taking Filters with bits() implemented
> and treat them separately.
> This behavior would be faster in the case for Filters with a forward index as
> the underlying data structure, where there would be no need to scan the index
> to build an iterator.
> See attached unit test, which fails without this patch.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]