DocumentFilter
IndexSettings.DocumentFilter 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.
public DocumentFilter DocumentFilter { get; set; }
Property Value
The document filter.
Examples
The example demonstrates how to set the document filter.
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
- class DocumentFilter
- class IndexSettings
- namespace GroupDocs.Search
- assembly GroupDocs.Search