|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.search.HitCollector
org.apache.lucene.search.TimeLimitedCollector
public class TimeLimitedCollector
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
Thrown when elapsed search time exceeds allowed search time. |
Field Summary | |
---|---|
boolean |
DEFAULT_GREEDY
Default for isGreedy() . |
static int |
DEFAULT_RESOLUTION
Default timer resolution. |
Constructor Summary | |
---|---|
TimeLimitedCollector(HitCollector hc,
long timeAllowed)
Create a TimeLimitedCollector wrapper over another HitCollector with a specified timeout. |
Method Summary | |
---|---|
void |
collect(int doc,
float score)
Calls collect() on the decorated HitCollector. |
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. |
static void |
setResolution(long newResolution)
Set the timer resolution. |
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 TimeLimitedCollector(HitCollector hc, long timeAllowed)
hc
- the wrapped HitCollectortimeAllowed
- max time allowed for collecting hits after which TimeLimitedCollector.TimeExceededException
is thrownMethod Detail |
---|
public void collect(int doc, float score)
collect
in class HitCollector
TimeLimitedCollector.TimeExceededException
- if the time allowed has been exceeded.public static long getResolution()
setResolution(long)
public static void setResolution(long newResolution)
public boolean isGreedy()
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
.
setGreedy(boolean)
public void setGreedy(boolean greedy)
greedy
- true to make this time limited greedyisGreedy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |