Class FilteredQuery.RandomAccessFilterStrategy

  extended by
      extended by
Enclosing class:

public static class FilteredQuery.RandomAccessFilterStrategy
extends FilteredQuery.FilterStrategy

A 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 Summary
Method Summary
 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.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public FilteredQuery.RandomAccessFilterStrategy()
Method Detail


public Scorer filteredScorer(AtomicReaderContext context,
                             boolean scoreDocsInOrder,
                             boolean topScorer,
                             Weight weight,
                             DocIdSet docIdSet)
                      throws IOException
Description copied from class: FilteredQuery.FilterStrategy
Returns a filtered Scorer based on this strategy.

Specified by:
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 apply
a filtered scorer
IOException - if an IOException occurs


protected boolean useRandomAccess(Bits bits,
                                  int firstFilterDoc)
Expert: decides if a filter should be executed as "random-access" or not. random-access means the filter "filters" in a similar way as deleted docs are filtered in Lucene. This is faster when the filter accepts many documents. However, when the filter is very sparse, it can be faster to execute the query+filter as a conjunction in some cases. The default implementation returns true if the first document accepted by the filter is < 100.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.