Case-sensitive search allows you to find words considering uppercase and lowercase letters as distinct. For example, words in context of case-sensitive search ‘Theory’, ’theory’, and ‘THEORY’ are all different.
Note that case-sensitive search is not compatible with other types of search (see Search flow).
The following example demonstrates how to perform case-sensitive search with a query in text form.
constindexFolder='c:/MyIndex/';constdocumentsFolder='c:/MyDocuments/';constindex=newgroupdocs.search.Index(indexFolder);// Creating index in the specified folder
index.add(documentsFolder);// Indexing documents from the specified folder
constoptions=newgroupdocs.search.SearchOptions();options.setUseCaseSensitiveSearch(true);// Enabling case sensitive search
constquery='Advantages';constresult=index.search(query,options);// Searching
The next example demonstrates how to perform case-sensitive search with a query in object form.
constindexFolder='c:/MyIndex/';constdocumentsFolder='c:/MyDocuments/';constindex=newgroupdocs.search.Index(indexFolder);// Creating index in the specified folder
index.add(documentsFolder);// Indexing documents from the specified folder
constoptions=newgroupdocs.search.SearchOptions();options.setUseCaseSensitiveSearch(true);// Enabling case sensitive search
constquery=groupdocs.search.SearchQuery.createWordQuery('Advantages');// Creating search query in object form
constresult=index.search(query,options);// Searching
More resources
GitHub examples
You may easily run the code from documentation articles and see the features in action in our GitHub examples: