IndexSettingsDocumentFilter Property
Gets or sets a document filter. The DocumentFilter works on the inclusion logic. Use the DocumentFilter class for creation of a document filter instances. The default value is null, which means that all added documents are indexed.

Namespace: GroupDocs.Search
Assembly: GroupDocs.Search (in GroupDocs.Search.dll) Version: 20.8
Syntax
public DocumentFilter DocumentFilter { get; set; }

Property Value

Type: DocumentFilter
The document filter.
Examples
The example demonstrates how to set the document filter.
C#
string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

// Creating a filter that skips documents with extensions '.doc', '.docx', '.rtf'
IndexSettings settings = new IndexSettings();
DocumentFilter fileExtensionFilter = DocumentFilter.CreateFileExtension(".doc", ".docx", ".rtf"); // Creating file extension filter
DocumentFilter invertedFilter = DocumentFilter.CreateNot(fileExtensionFilter); // Inverting file extension filter
settings.DocumentFilter = invertedFilter;

// Creating an index in the specified folder
Index index = new Index(indexFolder, settings);

// Indexing documents
index.Add(documentsFolder);

// Searching
SearchResult result = index.Search("Einstein");
See Also