C# Class Rebel.Lucene.IndexController

A simple index controller centred around asynchronous queuing of index modifications.
Inheritance: DisposableObject, IRequiresFrameworkContext
Show file Open project: RebelCMS/rebelcmsxu5 Class Usage Examples

Public Methods

Method Description
CreateDisposableReader ( ) : IndexReader

Creates an index reader. The caller is responsible for disposing the reader when done.

ForceFlushQueue ( ) : void
GetScopedLuceneSearcher ( ) : IndexSearcher

Gets an index searcher by using the reader whose lifetime is managed by GetScopedReader.

GetScopedReader ( ) : IndexReader

Gets a reader that is added to IFrameworkContext.ScopedCache, or returns the one already added. Disposal is handled by IFrameworkContext.ScopedFinalizer.

IndexController ( IndexConfiguration configuration, Func frameworkContextGetter ) : System
IndexController ( IndexConfiguration configuration, IFrameworkContext frameworkContext ) : System
Initialise ( ) : void
PartialFlushQueue ( int flushLimit ) : void
QueueAdd ( Document document ) : void

Queues the addition of an index document.

QueueBatch ( ) : void

Queues a batch of index modifications.

QueueRemoveAll ( ) : void

Queues the removal of all index documents.

Caller should also call ForceFlushQueue if they wish to block until the removal is flushed.

QueueRemoveWhere ( Term term ) : void

Queues the removal of an index document matching the supplied term.

Protected Methods

Method Description
DisposeResources ( ) : void
FlushQueue ( ) : void

Private Methods

Method Description
CreateLuceneReader ( ) : global::Lucene.Net.Index.IndexReader
CreateLuceneReader ( global::Lucene.Net.Store.Directory directory, bool secondAttempt = false ) : global::Lucene.Net.Index.IndexReader
CreateLuceneWriter ( ) : IndexWriter
CreateLuceneWriter ( StandardAnalyzer standardAnalyzer, global::Lucene.Net.Store.Directory directory ) : IndexWriter
CreateTransactionWorker ( ) : TransactionalIndexWorker
EnactBatch ( TransactionalIndexWorker worker, IndexModificationBatch batch ) : void
GetAnalyzer ( ) : StandardAnalyzer
GetBuildLocationInfo ( ) : DirectoryInfo
GetLuceneDirectory ( ) : global::Lucene.Net.Store.Directory
GetLuceneDirectory ( DirectoryInfo directory ) : global::Lucene.Net.Store.Directory
InitialiseBlankIndex ( global::Lucene.Net.Store.Directory directory ) : void
LogQueueMonitorError ( string logMessage, Exception exception ) : void
MonitorIndexBatch ( ) : void

Repeatedly checks IndexModificationQueue for new batches, and calls FlushQueue if any are found.

SetFrameworkContext ( IFrameworkContext frameworkContext ) : void

Sets the framework context. Used within IoC registration to avoid a circular reference / stack overflow because IFrameworkContext has Caches which could have this provider, which needs an IFrameworkContext

StartQueueMonitor ( ) : void

Starts the queue monitor Task.

Method Details

CreateDisposableReader() public method

Creates an index reader. The caller is responsible for disposing the reader when done.
public CreateDisposableReader ( ) : IndexReader
return IndexReader

DisposeResources() protected method

protected DisposeResources ( ) : void
return void

FlushQueue() protected method

protected FlushQueue ( ) : void
return void

ForceFlushQueue() public method

public ForceFlushQueue ( ) : void
return void

GetScopedLuceneSearcher() public method

Gets an index searcher by using the reader whose lifetime is managed by GetScopedReader.
public GetScopedLuceneSearcher ( ) : IndexSearcher
return IndexSearcher

GetScopedReader() public method

Gets a reader that is added to IFrameworkContext.ScopedCache, or returns the one already added. Disposal is handled by IFrameworkContext.ScopedFinalizer.
public GetScopedReader ( ) : IndexReader
return IndexReader

IndexController() public method

public IndexController ( IndexConfiguration configuration, Func frameworkContextGetter ) : System
configuration IndexConfiguration
frameworkContextGetter Func
return System

IndexController() public method

public IndexController ( IndexConfiguration configuration, IFrameworkContext frameworkContext ) : System
configuration IndexConfiguration
frameworkContext IFrameworkContext
return System

Initialise() public method

public Initialise ( ) : void
return void

PartialFlushQueue() public method

public PartialFlushQueue ( int flushLimit ) : void
flushLimit int
return void

QueueAdd() public method

Queues the addition of an index document.
public QueueAdd ( Document document ) : void
document Document The document.
return void

QueueBatch() public method

Queues a batch of index modifications.
public QueueBatch ( ) : void
return void

QueueRemoveAll() public method

Queues the removal of all index documents.
Caller should also call ForceFlushQueue if they wish to block until the removal is flushed.
public QueueRemoveAll ( ) : void
return void

QueueRemoveWhere() public method

Queues the removal of an index document matching the supplied term.
public QueueRemoveWhere ( Term term ) : void
term Term The term.
return void