Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
Classes | Public Member Functions | Public Attributes | Properties | List of all members
Lucene.Net.Search.TimeLimitingCollector Class Reference

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:

  • 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.

 
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.
 

Detailed Description

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.

Constructor & Destructor Documentation

Lucene.Net.Search.TimeLimitingCollector.TimeLimitingCollector ( Collector  collector,
long  timeAllowed 
)

Create a TimeLimitedCollector wrapper over another Collector with a specified timeout.

Parameters
collectorthe wrapped Collector
timeAllowedmax time allowed for collecting hits after which TimeExceededException is thrown

Definition at line 143 of file TimeLimitingCollector.cs.

Member Function Documentation

override void Lucene.Net.Search.TimeLimitingCollector.Collect ( int  doc)
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.

override void Lucene.Net.Search.TimeLimitingCollector.SetNextReader ( IndexReader  reader,
int  docBase 
)
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).

Parameters
readernext IndexReader
docBase

Implements Lucene.Net.Search.Collector.

Definition at line 211 of file TimeLimitingCollector.cs.

override void Lucene.Net.Search.TimeLimitingCollector.SetScorer ( Scorer  scorer)
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.

Member Data Documentation

bool Lucene.Net.Search.TimeLimitingCollector.DEFAULT_GREEDY = false

Default for IsGreedy().

See Also
IsGreedy()

Definition at line 45 of file TimeLimitingCollector.cs.

const int Lucene.Net.Search.TimeLimitingCollector.DEFAULT_RESOLUTION = 20

Default timer resolution.

See Also
Resolution

Definition at line 40 of file TimeLimitingCollector.cs.

Property Documentation

override bool Lucene.Net.Search.TimeLimitingCollector.AcceptsDocsOutOfOrder
get

Definition at line 223 of file TimeLimitingCollector.cs.

virtual bool Lucene.Net.Search.TimeLimitingCollector.IsGreedy
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.

long Lucene.Net.Search.TimeLimitingCollector.Resolution
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:

  • 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.

Definition at line 166 of file TimeLimitingCollector.cs.


The documentation for this class was generated from the following file: