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 TimeExceededException
.
More...
#include <TimeLimitingCollector.h>
|
static String | _getClassName () |
|
static int64_t | getResolution () |
| Return the timer resolution.
|
|
static void | setResolution (int64_t newResolution) |
| 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:
|
|
static void | stopTimer () |
| Stop timer thread.
|
|
static String | _getClassName () |
|
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 TimeExceededException
.
◆ TimeLimitingCollector()
Lucene::TimeLimitingCollector::TimeLimitingCollector |
( |
const CollectorPtr & |
collector, |
|
|
int64_t |
timeAllowed |
|
) |
| |
Create a TimeLimitedCollector wrapper over another Collector
with a specified timeout.
- Parameters
-
collector | the wrapped Collector |
timeAllowed | max time allowed for collecting hits after which TimeExceeded exception is thrown |
◆ ~TimeLimitingCollector()
virtual Lucene::TimeLimitingCollector::~TimeLimitingCollector |
( |
| ) |
|
|
virtual |
◆ _getClassName()
static String Lucene::TimeLimitingCollector::_getClassName |
( |
| ) |
|
|
inlinestatic |
◆ acceptsDocsOutOfOrder()
virtual bool Lucene::TimeLimitingCollector::acceptsDocsOutOfOrder |
( |
| ) |
|
|
virtual |
Return true if this collector does not require the matching docIDs to be delivered in int sort order (smallest to largest) to collect
.
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.
Implements Lucene::Collector.
◆ collect()
virtual void Lucene::TimeLimitingCollector::collect |
( |
int32_t |
doc | ) |
|
|
virtual |
◆ getClassName()
virtual String Lucene::TimeLimitingCollector::getClassName |
( |
| ) |
|
|
inlinevirtual |
◆ getResolution()
static int64_t Lucene::TimeLimitingCollector::getResolution |
( |
| ) |
|
|
static |
◆ isGreedy()
bool Lucene::TimeLimitingCollector::isGreedy |
( |
| ) |
|
Checks if this time limited collector is greedy in collecting the last hit. A non greedy collector, upon a timeout, would throw a TimeExceeded 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 TimeExceeded exception.
- See also
- #setGreedy(boolean)
◆ setGreedy()
void Lucene::TimeLimitingCollector::setGreedy |
( |
bool |
greedy | ) |
|
Sets whether this time limited collector is greedy.
- Parameters
-
greedy | true to make this time limited greedy |
- See also
- isGreedy()
◆ setNextReader()
virtual void Lucene::TimeLimitingCollector::setNextReader |
( |
const IndexReaderPtr & |
reader, |
|
|
int32_t |
docBase |
|
) |
| |
|
virtual |
◆ setResolution()
static void Lucene::TimeLimitingCollector::setResolution |
( |
int64_t |
newResolution | ) |
|
|
static |
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:
-
Finer (smaller) resolution is more accurate but less efficient.
-
Setting resolution to less than 5 milliseconds will be silently modified to 5 milliseconds.
-
Setting resolution smaller than current resolution might take effect only after current resolution. (Assume current resolution of 20 milliseconds is modified to 5 milliseconds, then it can take up to 20 milliseconds for the change to have effect.
◆ setScorer()
virtual void Lucene::TimeLimitingCollector::setScorer |
( |
const ScorerPtr & |
scorer | ) |
|
|
virtual |
◆ shared_from_this()
◆ stopTimer()
static void Lucene::TimeLimitingCollector::stopTimer |
( |
| ) |
|
|
static |
◆ TIMER_THREAD()
Initialize a single static timer thread to be used by all TimeLimitedCollector instances.
◆ collector
◆ DEFAULT_GREEDY
bool Lucene::TimeLimitingCollector::DEFAULT_GREEDY |
◆ DEFAULT_RESOLUTION
const int32_t Lucene::TimeLimitingCollector::DEFAULT_RESOLUTION |
|
static |
◆ docBase
int32_t Lucene::TimeLimitingCollector::docBase |
|
protected |
◆ greedy
bool Lucene::TimeLimitingCollector::greedy |
|
protected |
◆ resolution
int64_t Lucene::TimeLimitingCollector::resolution |
|
staticprotected |
◆ t0
int64_t Lucene::TimeLimitingCollector::t0 |
|
protected |
◆ timeout
int64_t Lucene::TimeLimitingCollector::timeout |
|
protected |
The documentation for this class was generated from the following file: