Last active
June 14, 2019 13:32
-
-
Save GroupDocsGists/9219657f9f98d68c9719ccd7ca5fc5d2 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-Java | |
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 | |
//Filter filter3 will only accept TXT and DOC documents with text 'Tolkien' in file names | |
SearchParameters parameters = new SearchParameters(); | |
ISearchDocumentFilter filter1 = SearchDocumentFilter.createFileExtension(".txt", ".doc"); | |
ISearchDocumentFilter filter2 = SearchDocumentFilter.createFileNameRegularExpression("task"); | |
ISearchDocumentFilter filter3 = SearchDocumentFilter.createConjunction(filter1, filter2); | |
parameters.setSearchDocumentFilter(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