EventHubFileIndexing Event
Occurs when a document is going to be indexed.

Namespace: GroupDocs.Search.Events
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 21.8.1
Syntax
public event EventHandler<FileIndexingEventArgs> FileIndexing

Value

Type: SystemEventHandlerFileIndexingEventArgs
Examples
The example demonstrates how to use the event.
C#
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

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

// Subscribing to the event
index.Events.FileIndexing += (sender, args) =>
{
    if (args.DocumentFullPath.EndsWith("Protected.pdf", StringComparison.InvariantCultureIgnoreCase))
    {
        args.AdditionalFields = new DocumentField[]
        {
            new DocumentField("Tags", "Protected")
        };
    }
    if (!args.DocumentFullPath.ToLowerInvariant().Contains("important"))
    {
        args.SkipIndexing = true;
    }
};

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