Last active
June 11, 2019 08:48
-
-
Save GroupDocsGists/4dfcdf9857e743254611fd918a2cbc86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For complete examples and data files, please go to https://github.com/groupdocs-search/GroupDocs.Search-for-.NET | |
string indexFolder = @"c:\MyIndex"; | |
string documentFolder = @"c:\MyDocuments"; | |
//Creating index | |
Index index = new Index(indexFolder); | |
//Adding documents to index | |
index.AddToIndex(documentFolder); | |
//Configuring document filter | |
//filter3 will only accept TXT and DOCX documents with text 'task' in file names | |
SearchParameters parameters = new SearchParameters(); | |
ISearchDocumentFilter filter1 = SearchDocumentFilter.CreateFileExtension(".txt", ".docx"); | |
ISearchDocumentFilter filter2 = SearchDocumentFilter.CreateFileNameRegularExpression("task"); | |
ISearchDocumentFilter filter3 = SearchDocumentFilter.CreateConjunction(filter1, filter2); | |
parameters.SearchDocumentFilter = filter3; | |
//Searching | |
SearchResults results = index.Search("hobbit", parameters); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment