EventHubFileIndexing Event |
Namespace: GroupDocs.Search.Events
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);