Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
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...
Inherits Lucene.Net.Search.Collector.
Classes | |
class | TimeExceededException |
Thrown when elapsed search time exceeds allowed search time. More... | |
Public Member Functions | |
TimeLimitingCollector (Collector collector, long timeAllowed) | |
Create a TimeLimitedCollector wrapper over another Collector with a specified timeout. | |
override void | Collect (int doc) |
Calls Collector.Collect(int) on the decorated Collector unless the allowed time has passed, in which case it throws an exception. | |
override void | SetNextReader (IndexReader reader, int base_Renamed) |
Called before collecting from each IndexReader. All doc ids in Collect(int) will correspond to reader. | |
override void | SetScorer (Scorer scorer) |
Called before successive calls to Collect(int). Implementations that need the score of the current document (passed-in to Collect(int)), should save the passed-in Scorer and call scorer.score() when needed. | |
Public Attributes | |
const int | DEFAULT_RESOLUTION = 20 |
Default timer resolution. | |
bool | DEFAULT_GREEDY = false |
Default for IsGreedy(). | |
Properties | |
static long | Resolution [get, set] |
Gets or sets 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:
| |
virtual bool | IsGreedy [get, set] |
Checks if this time limited collector is greedy in collecting the last hit. A non greedy collector, upon a timeout, would throw a 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 TimeExceededException. | |
override bool | AcceptsDocsOutOfOrder [get] |
Properties inherited from Lucene.Net.Search.Collector | |
abstract bool | AcceptsDocsOutOfOrder [get] |
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. | |
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.
Definition at line 30 of file TimeLimitingCollector.cs.
Lucene.Net.Search.TimeLimitingCollector.TimeLimitingCollector | ( | Collector | collector, |
long | timeAllowed | ||
) |
Create a TimeLimitedCollector wrapper over another Collector with a specified timeout.
collector | the wrapped Collector |
timeAllowed | max time allowed for collecting hits after which TimeExceededException is thrown |
Definition at line 143 of file TimeLimitingCollector.cs.
|
virtual |
Calls Collector.Collect(int) on the decorated Collector unless the allowed time has passed, in which case it throws an exception.
<throws> TimeExceededException </throws>
if the time allowed has exceeded.
Implements Lucene.Net.Search.Collector.
Definition at line 194 of file TimeLimitingCollector.cs.
|
virtual |
Called before collecting from each IndexReader. All doc ids in Collect(int) will correspond to reader.
Add docBase to the current IndexReaders internal document id to re-base ids in Collect(int).
reader | next IndexReader |
docBase |
Implements Lucene.Net.Search.Collector.
Definition at line 211 of file TimeLimitingCollector.cs.
|
virtual |
Called before successive calls to Collect(int). Implementations that need the score of the current document (passed-in to Collect(int)), should save the passed-in Scorer and call scorer.score() when needed.
Implements Lucene.Net.Search.Collector.
Definition at line 217 of file TimeLimitingCollector.cs.
bool Lucene.Net.Search.TimeLimitingCollector.DEFAULT_GREEDY = false |
const int Lucene.Net.Search.TimeLimitingCollector.DEFAULT_RESOLUTION = 20 |
Default timer resolution.
Definition at line 40 of file TimeLimitingCollector.cs.
|
get |
Definition at line 223 of file TimeLimitingCollector.cs.
|
getset |
Checks if this time limited collector is greedy in collecting the last hit. A non greedy collector, upon a timeout, would throw a 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 TimeExceededException.
Definition at line 182 of file TimeLimitingCollector.cs.
|
staticgetset |
Gets or sets 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:
Definition at line 166 of file TimeLimitingCollector.cs.