public static class XFilteredQuery.CustomRandomAccessFilterStrategy
extends org.apache.lucene.search.FilteredQuery.RandomAccessFilterStrategy
FilteredQuery.RandomAccessFilterStrategy
.
Adds a threshold value, which defaults to -1. When set to -1, it will check if the filter docSet is
*not* a fast docSet, and if not, it will use FilteredQuery.QUERY_FIRST_FILTER_STRATEGY
(since
the assumption is that its a "slow" filter and better computed only on whatever matched the query).
If the threshold value is 0, it always tries to pass "down" the filter as acceptDocs, and it the filter
can't be represented as Bits (never really), then it uses FilteredQuery.LEAP_FROG_QUERY_FIRST_STRATEGY
.
If the above conditions are not met, then it reverts to the FilteredQuery.RandomAccessFilterStrategy
logic,
with the threshold used to control useRandomAccess(org.apache.lucene.util.Bits, int)
.Constructor and Description |
---|
CustomRandomAccessFilterStrategy() |
CustomRandomAccessFilterStrategy(int threshold) |
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.search.Scorer |
filteredScorer(org.apache.lucene.index.AtomicReaderContext context,
org.apache.lucene.search.Weight weight,
org.apache.lucene.search.DocIdSet docIdSet) |
protected boolean |
useRandomAccess(org.apache.lucene.util.Bits bits,
int firstFilterDoc)
Expert: decides if a filter should be executed as "random-access" or not.
|
public CustomRandomAccessFilterStrategy()
public CustomRandomAccessFilterStrategy(int threshold)
public org.apache.lucene.search.Scorer filteredScorer(org.apache.lucene.index.AtomicReaderContext context, org.apache.lucene.search.Weight weight, org.apache.lucene.search.DocIdSet docIdSet) throws IOException
filteredScorer
in class org.apache.lucene.search.FilteredQuery.RandomAccessFilterStrategy
IOException
protected boolean useRandomAccess(org.apache.lucene.util.Bits bits, int firstFilterDoc)
true
if the first document accepted by the
filter is < threshold, if threshold is -1 (the default), then it checks for < 100.useRandomAccess
in class org.apache.lucene.search.FilteredQuery.RandomAccessFilterStrategy
Copyright © 2009–2015. All rights reserved.