DocumentFilter class

DocumentFilter class

Represents the base class for document filters and provides methods to create document filter instances.

Learn more: Document filtering during indexing.

The DocumentFilter type exposes the following members:

Methods

Method Description
create_and Creates a logical conjunction of the specified filters.
create_creation_time_lower_bound Creates a filter for skipping documents with a creation date earlier than the specified lower bound.
create_creation_time_range Creates a filter that skips documents whose creation date is outside the specified range.
create_creation_time_upper_bound Creates a filter for skipping documents with a creation date later than the upper bound.
create_file_extension Creates a filter that skips documents without the specified extensions.
create_file_length_lower_bound Creates a filter that skips documents whose length is less than the specified lower bound.
create_file_length_range Creates a filter for skipping documents out of the specified document length range.
create_file_length_upper_bound Creates a filter for skipping documents with the length greater than the upper bound.
create_file_path_regular_expression Creates a filter that skips documents whose full path does not match a regular expression.
create_file_path_regular_expression Creates a filter for skipping documents that do not match a regular expression. The regular expression is applied to the full path of a document.
create_modification_time_lower_bound Creates a filter for skipping documents with modification date earlier than the lower bound.
create_modification_time_range Creates a filter for skipping documents with modification date out of the specified range.
create_modification_time_upper_bound Creates a filter for skipping documents with modification dates later than the upper bound.
create_not Creates a filter that inverts the logic of the specified inner filter.
create_or Creates a logical disjunction of the specified filters.
to_string Returns string representation of a document filter.

Example

from groupdocs.search import IndexSettings
from groupdocs.search.options import DocumentFilter
import datetime

# Include only .htm and .html files
ext_filter = DocumentFilter.create_file_extension(".htm", ".html")

# Invert the filter to exclude those extensions
filter = DocumentFilter.create_not(ext_filter)

# Apply the filter to index settings
settings = IndexSettings()
settings.document_filter = filter

print(settings.document_filter)

See Also