org.apache.lucene.search
public static class FilteredQuery.RandomAccessFilterStrategy extends FilteredQuery.FilterStrategy
FilteredQuery.FilterStrategy
that conditionally uses a random access filter if
the given DocIdSet
supports random access (returns a non-null value
from DocIdSet.bits()
) and
useRandomAccess(Bits, int)
returns
true
. Otherwise this strategy falls back to a "zig-zag join" (
FilteredQuery.LEAP_FROG_FILTER_FIRST_STRATEGY
) strategy .Constructor and Description |
---|
FilteredQuery.RandomAccessFilterStrategy() |
Modifier and Type | Method and Description |
---|---|
Scorer |
filteredScorer(AtomicReaderContext context,
boolean scoreDocsInOrder,
boolean topScorer,
Weight weight,
DocIdSet docIdSet)
Returns a filtered
Scorer based on this strategy. |
protected boolean |
useRandomAccess(Bits bits,
int firstFilterDoc)
Expert: decides if a filter should be executed as "random-access" or not.
|
public FilteredQuery.RandomAccessFilterStrategy()
public Scorer filteredScorer(AtomicReaderContext context, boolean scoreDocsInOrder, boolean topScorer, Weight weight, DocIdSet docIdSet) throws IOException
FilteredQuery.FilterStrategy
Scorer
based on this strategy.filteredScorer
in class FilteredQuery.FilterStrategy
context
- the AtomicReaderContext
for which to return the Scorer
.scoreDocsInOrder
- specifies whether in-order scoring of documents is required. Note
that if set to false (i.e., out-of-order scoring is required),
this method can return whatever scoring mode it supports, as every
in-order scorer is also an out-of-order one. However, an
out-of-order scorer may not support DocIdSetIterator.nextDoc()
and/or DocIdSetIterator.advance(int)
, therefore it is recommended to
request an in-order scorer if use of these methods is required.topScorer
- if true, Scorer.score(Collector)
will be called; if false,
DocIdSetIterator.nextDoc()
and/or DocIdSetIterator.advance(int)
will
be called.weight
- the FilteredQuery
Weight
to create the filtered scorer.docIdSet
- the filter DocIdSet
to applyIOException
- if an IOException
occursprotected boolean useRandomAccess(Bits bits, int firstFilterDoc)
true
if the first document accepted by the
filter is < 100.Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.