EventHub class

EventHub class

Provides index events for subscribing.

Learn more:

The EventHub type exposes the following members:

Events

Event Description
error_occurred Occurs when an error occurs during an index operation.
file_indexing Occurs when a document is going to be indexed.
image_preparing Occurs when an image is going to be prepared for indexing.
operation_finished Occurs when an index operation is finished.
operation_progress_changed Occurs when the progress of the indexing or update operation changes.
optimization_progress_changed Occurs when the progress of the optimization operation changes.
password_required Occurs when a document requires password for opening.
search_phase_completed Occurs when the search phase is completed.
status_changed Occurs when the index status changes.

Example

from groupdocs.search import Index

index_folder = "./MyIndex"
documents_folder = "./documents"
query = "Einstein"

index = Index(index_folder)

def on_error(sender, args):
    print(args.message)

index.events.error_occurred += on_error

index.add(documents_folder)

result = index.search(query)

See Also