SearchDocumentFilter class

SearchDocumentFilter class

Provides methods for creating search document filters.

Learn more:

The SearchDocumentFilter type exposes the following members:

Methods

Method Description
create_and Creates a logical conjunction of the specified filters.
create_attribute Creates a filter that excludes documents lacking any of the specified attributes.
create_file_extension Creates a filter for skipping documents that are not in the specified list of possible extensions.
create_file_path_regular_expression Creates a filter that skips documents whose full path does not match the given regular expression.
create_file_path_regular_expression Creates a filter that skips documents not matching a regular expression.
create_not Creates a filter that has inverse logic in relation to the specified inner filter.
create_or Creates a logical disjunction of the specified filters.

Example

from groupdocs.search import RegexOptions
from groupdocs.search.options import SearchDocumentFilter

# Filter documents that have the attribute "main"
attribute_filter = SearchDocumentFilter.create_attribute("main")

# Filter files whose path contains "Einstein" (case‑insensitive)
path_filter = SearchDocumentFilter.create_file_path_regular_expression(
    "Einstein", RegexOptions.IGNORE_CASE
)

# Exclude TXT files from results
txt_filter = SearchDocumentFilter.create_file_extension(".txt")
not_txt_filter = SearchDocumentFilter.create_not(txt_filter)

See Also