EventHub

EventHub class

Provides index events for subscribing.

public class EventHub

Events

Name Description
event ErrorOccurred Occurs when an error occurs during an index operation.
event FileIndexing Occurs when a document is going to be indexed.
event ImagePreparing Occurs when an image is going to be prepared for indexing.
event OperationFinished Occurs when an index operation is finished.
event OperationProgressChanged Occurs when the progress of the indexing or update operation changes.
event OptimizationProgressChanged Occurs when the progress of the optimization operation changes.
event PasswordRequired Occurs when a document requires a password for opening.
event SearchPhaseCompleted Occurs when the search phase is completed.
event StatusChanged Occurs when the index status changes.

Remarks

An exception thrown by an event handler is not passed to the index: the other handlers of the event are called, the operation that raised the event continues, and the exception is written to the log of the index (see Logger). An exception of a handler of an event of an IndexRepository is written to the log of the index that raised the event; if the event is raised by the repository itself, the exception is not logged.

Learn more

Examples

The example demonstrates a typical usage of the class.

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
string query = "Einstein";

// Creating an index
Index index = new Index(indexFolder);

// Subscribing to the event
index.Events.ErrorOccurred += (sender, args) =>
{
    Console.WriteLine(args.Message);
};

// Indexing documents from the specified folder
index.Add(documentsFolder);

// Searching in the index
SearchResult result = index.Search(query);

See Also