org.apache.lucene.search
Class TimeLimitedCollector

java.lang.Object
  extended by org.apache.lucene.search.HitCollector
      extended by org.apache.lucene.search.TimeLimitedCollector

Deprecated. Use TimeLimitingCollector instead, which extends the new Collector. This class will be removed in 3.0.

public class TimeLimitedCollector
extends HitCollector

The TimeLimitedCollector 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 TimeExceeded Exception.


Nested Class Summary
static class TimeLimitedCollector.TimeExceededException
          Deprecated. Thrown when elapsed search time exceeds allowed search time.
 
Field Summary
 boolean DEFAULT_GREEDY
          Deprecated. Default for isGreedy().
static int DEFAULT_RESOLUTION
          Deprecated. Default timer resolution.
 
Constructor Summary
TimeLimitedCollector(HitCollector hc, long timeAllowed)
          Deprecated. Create a TimeLimitedCollector wrapper over another HitCollector with a specified timeout.
 
Method Summary
 void collect(int doc, float score)
          Deprecated. Calls collect() on the decorated HitCollector.
static long getResolution()
          Deprecated. Return the timer resolution.
 boolean isGreedy()
          Deprecated. Checks if this time limited collector is greedy in collecting the last hit.
 void setGreedy(boolean greedy)
          Deprecated. Sets whether this time limited collector is greedy.
static void setResolution(long newResolution)
          Deprecated. Set the timer resolution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RESOLUTION

public static final int DEFAULT_RESOLUTION
Deprecated. 
Default timer resolution.

See Also:
setResolution(long), Constant Field Values

DEFAULT_GREEDY

public boolean DEFAULT_GREEDY
Deprecated. 
Default for isGreedy().

See Also:
isGreedy()
Constructor Detail

TimeLimitedCollector

public TimeLimitedCollector(HitCollector hc,
                            long timeAllowed)
Deprecated. 
Create a TimeLimitedCollector wrapper over another HitCollector with a specified timeout.

Parameters:
hc - the wrapped HitCollector
timeAllowed - max time allowed for collecting hits after which TimeLimitedCollector.TimeExceededException is thrown
Method Detail

collect

public void collect(int doc,
                    float score)
Deprecated. 
Calls collect() on the decorated HitCollector.

Specified by:
collect in class HitCollector
Throws:
TimeLimitedCollector.TimeExceededException - if the time allowed has been exceeded.

getResolution

public static long getResolution()
Deprecated. 
Return the timer resolution.

See Also:
setResolution(long)

setResolution

public static void setResolution(long newResolution)
Deprecated. 
Set the timer resolution. The default timer resolution is 20 milliseconds. This means that a search required to take no longer than 800 milliseconds may be stopped after 780 to 820 milliseconds.
Note that:


isGreedy

public boolean isGreedy()
Deprecated. 
Checks if this time limited collector is greedy in collecting the last hit. A non greedy collector, upon a timeout, would throw a TimeLimitedCollector.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 TimeLimitedCollector.TimeExceededException.

See Also:
setGreedy(boolean)

setGreedy

public void setGreedy(boolean greedy)
Deprecated. 
Sets whether this time limited collector is greedy.

Parameters:
greedy - true to make this time limited greedy
See Also:
isGreedy()


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