| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.lucene.search.Collector
org.apache.lucene.search.TimeLimitingCollector
public class TimeLimitingCollector
The TimeLimitingCollector is used to timeout search requests that
 take longer than the maximum allowed search time limit. After this time is
 exceeded, the search thread is stopped by throwing a
 TimeLimitingCollector.TimeExceededException.
| Nested Class Summary | |
|---|---|
| static class | TimeLimitingCollector.TimeExceededExceptionThrown when elapsed search time exceeds allowed search time. | 
| Field Summary | |
|---|---|
|  boolean | DEFAULT_GREEDYDefault for isGreedy(). | 
| static int | DEFAULT_RESOLUTIONDefault timer resolution. | 
| Constructor Summary | |
|---|---|
| TimeLimitingCollector(Collector collector,
                      long timeAllowed)Create a TimeLimitedCollector wrapper over another Collectorwith a specified timeout. | |
| Method Summary | |
|---|---|
|  boolean | acceptsDocsOutOfOrder()Return trueif this collector does not
 require the matching docIDs to be delivered in int sort
 order (smallest to largest) toCollector.collect(int). | 
|  void | collect(int doc)Calls Collector.collect(int)on the decoratedCollectorunless the allowed time has passed, in which case it throws an exception. | 
| static long | getResolution()Return the timer resolution. | 
|  boolean | isGreedy()Checks if this time limited collector is greedy in collecting the last hit. | 
|  void | setGreedy(boolean greedy)Sets whether this time limited collector is greedy. | 
|  void | setNextReader(IndexReader reader,
              int base)Called before collecting from each IndexReader. | 
| static void | setResolution(long newResolution)Set the timer resolution. | 
|  void | setScorer(Scorer scorer)Called before successive calls to Collector.collect(int). | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int DEFAULT_RESOLUTION
setResolution(long), 
Constant Field Valuespublic boolean DEFAULT_GREEDY
isGreedy().
isGreedy()| Constructor Detail | 
|---|
public TimeLimitingCollector(Collector collector,
                             long timeAllowed)
Collector with a specified timeout.
collector - the wrapped CollectortimeAllowed - max time allowed for collecting hits after which TimeLimitingCollector.TimeExceededException is thrown| Method Detail | 
|---|
public static long getResolution()
setResolution(long)public static void setResolution(long newResolution)
public boolean isGreedy()
TimeLimitingCollector.TimeExceededException 
 without allowing the wrapped collector to collect current doc. A greedy one would 
 first allow the wrapped hit collector to collect current doc and only then 
 throw a TimeLimitingCollector.TimeExceededException.
setGreedy(boolean)public void setGreedy(boolean greedy)
greedy - true to make this time limited greedyisGreedy()
public void collect(int doc)
             throws IOException
Collector.collect(int) on the decorated Collector
 unless the allowed time has passed, in which case it throws an exception.
collect in class CollectorTimeLimitingCollector.TimeExceededException - if the time allowed has exceeded.
IOException
public void setNextReader(IndexReader reader,
                          int base)
                   throws IOException
CollectorCollector.collect(int) will correspond to reader.
 
 Add docBase to the current IndexReaders internal document id to re-base ids
 in Collector.collect(int).
setNextReader in class Collectorreader - next IndexReader
IOException
public void setScorer(Scorer scorer)
               throws IOException
CollectorCollector.collect(int). Implementations
 that need the score of the current document (passed-in to
 Collector.collect(int)), should save the passed-in Scorer and call
 scorer.score() when needed.
setScorer in class CollectorIOExceptionpublic boolean acceptsDocsOutOfOrder()
Collectortrue if this collector does not
 require the matching docIDs to be delivered in int sort
 order (smallest to largest) to Collector.collect(int).
  Most Lucene Query implementations will visit
 matching docIDs in order.  However, some queries
 (currently limited to certain cases of BooleanQuery) can achieve faster searching if the
 Collector allows them to deliver the
 docIDs out of order.
 Many collectors don't mind getting docIDs out of
 order, so it's important to return true
 here.
acceptsDocsOutOfOrder in class Collector| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||