Creates a filter that excludes documents lacking any of the specified attributes.
defcreate_attribute(cls,attributes):...
Parameter
Type
Description
attributes
list[str]
The list of allowable attributes.
Returns: SearchDocumentFilter: A filter that matches documents containing at least one of the given attributes.
Example
importosfromgroupdocs.searchimportIndexfromgroupdocs.search.optionsimportSearchDocumentFilter,SearchOptionsindex=Index("./index")index.add("./documents")# Create a filter that matches documents with the "main" attributedocument_filter=SearchDocumentFilter.create_attribute(["main"])# Apply the filter to a search operationoptions=SearchOptions()options.search_document_filter=document_filterresult=index.search("Einstein",options)forfoundinresult:print("Found:",os.path.basename(found.document_info.file_path))```### See Also*class[`SearchDocumentFilter`](/search/python-net/groupdocs.search.options/searchdocumentfilter/)
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.