Show / Hide Table of Contents

    Class TimeLimitingCollector

    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 TimeLimitingCollector.TimeExceededException.

    Inheritance
    System.Object
    TimeLimitingCollector
    Implements
    ICollector
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Search
    Assembly: Lucene.Net.dll
    Syntax
    public class TimeLimitingCollector : ICollector

    Constructors

    | Improve this Doc View Source

    TimeLimitingCollector(ICollector, Counter, Int64)

    Create a TimeLimitingCollector wrapper over another ICollector with a specified timeout.

    Declaration
    public TimeLimitingCollector(ICollector collector, Counter clock, long ticksAllowed)
    Parameters
    Type Name Description
    ICollector collector

    The wrapped ICollector

    Counter clock

    The timer clock

    System.Int64 ticksAllowed

    Max time allowed for collecting hits after which TimeLimitingCollector.TimeExceededException is thrown

    Properties

    | Improve this Doc View Source

    AcceptsDocsOutOfOrder

    Declaration
    public virtual bool AcceptsDocsOutOfOrder { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    GlobalCounter

    Returns the global TimeLimitingCollector.TimerThread's Counter

    Invoking this creates may create a new instance of TimeLimitingCollector.TimerThread iff the global TimeLimitingCollector.TimerThread has never been accessed before. The thread returned from this method is started on creation and will be alive unless you stop the TimeLimitingCollector.TimerThread via StopTimer().

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Declaration
    public static Counter GlobalCounter { get; }
    Property Value
    Type Description
    Counter

    the global TimerThreads Counter

    | Improve this Doc View Source

    GlobalTimerThread

    Returns the global TimeLimitingCollector.TimerThread.

    Invoking this creates may create a new instance of TimeLimitingCollector.TimerThread iff the global TimeLimitingCollector.TimerThread has never been accessed before. The thread returned from this method is started on creation and will be alive unless you stop the TimeLimitingCollector.TimerThread via StopTimer().

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Declaration
    public static TimeLimitingCollector.TimerThread GlobalTimerThread { get; }
    Property Value
    Type Description
    TimeLimitingCollector.TimerThread

    the global TimeLimitingCollector.TimerThread

    | Improve this Doc View Source

    IsGreedy

    Checks if this time limited collector is greedy in collecting the last hit. A non greedy collector, upon a timeout, would throw a TimeLimitingCollector.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 TimeLimitingCollector.TimeExceededException.

    Declaration
    public virtual bool IsGreedy { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Collect(Int32)

    Calls Collect(Int32) on the decorated ICollector unless the allowed time has passed, in which case it throws an exception.

    Declaration
    public virtual void Collect(int doc)
    Parameters
    Type Name Description
    System.Int32 doc
    Exceptions
    Type Condition
    TimeLimitingCollector.TimeExceededException

    If the time allowed has exceeded.

    | Improve this Doc View Source

    SetBaseline()

    Syntactic sugar for SetBaseline(Int64) using Get() on the clock passed to the constructor.

    Declaration
    public virtual void SetBaseline()
    | Improve this Doc View Source

    SetBaseline(Int64)

    Sets the baseline for this collector. By default the collectors baseline is initialized once the first reader is passed to the collector. To include operations executed in prior to the actual document collection set the baseline through this method in your prelude.

    Example usage:

        // Counter is in the Lucene.Net.Util namespace
        Counter clock = Counter.NewCounter(true);
        long baseline = clock.Get();
        // ... prepare search
        TimeLimitingCollector collector = new TimeLimitingCollector(c, clock, numTicks);
        collector.SetBaseline(baseline);
        indexSearcher.Search(query, collector);

    Declaration
    public virtual void SetBaseline(long clockTime)
    Parameters
    Type Name Description
    System.Int64 clockTime
    See Also
    SetBaseline()
    | Improve this Doc View Source

    SetCollector(ICollector)

    This is so the same timer can be used with a multi-phase search process such as grouping. We don't want to create a new TimeLimitingCollector for each phase because that would reset the timer for each phase. Once time is up subsequent phases need to timeout quickly.

    Declaration
    public virtual void SetCollector(ICollector collector)
    Parameters
    Type Name Description
    ICollector collector

    The actual collector performing search functionality.

    | Improve this Doc View Source

    SetNextReader(AtomicReaderContext)

    Declaration
    public virtual void SetNextReader(AtomicReaderContext context)
    Parameters
    Type Name Description
    AtomicReaderContext context
    | Improve this Doc View Source

    SetScorer(Scorer)

    Declaration
    public virtual void SetScorer(Scorer scorer)
    Parameters
    Type Name Description
    Scorer scorer

    Implements

    ICollector

    Extension Methods

    Number.IsNumber(Object)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Licensed to the Apache Software Foundation (ASF)