Case sensitive search

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Search MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-search -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-search/search-net-mcp:latest
Folders, licensing and more →

Case-sensitive search allows you to find words considering uppercase and lowercase letters as distinct. For example, in the context of case-sensitive search, the words ‘Theory’, ’theory’, and ‘THEORY’ are all different.

Note that case-sensitive search cannot be combined with fuzzy search, synonym search, homophone search, word forms search, spelling correction, and keyboard layout correction (see Search flow). If case-sensitive search is enabled together with any of these options, the search does not throw an exception: it returns an empty result and raises the ErrorOccurred event of the index with a message describing the conflict. For details, see the Search options page.

A word pattern (see Wildcard search) and a regular expression (see Regular expression search) are matched with the words of the index without regard to the letter case. Since version 26.11, in a case-sensitive search such a part of a query finds the words in any letter case, and the Warnings property of the result tells it by the line “Letter case ignored for query: " followed by the part of the query; the other parts of the query are case-sensitive. Before, such a part found only the occurrences of the words in lower case: for example, the pattern Vend?(0~5) found ‘vendor’ but not ‘Vendor’. A word that such a part finds is given in the found terms (FoundDocumentField.Terms) in its form in lower case, in upper case or with the first letter in upper case, for example ‘vendor’, ‘VENDOR’ and ‘Vendor’, and the highlighting marks these forms as it marks the words of a case-sensitive search. A word written in another mix of the cases, for example ‘VenDor’, is found and counted, but it is given in lower case and is not highlighted. To find one form of a word, search for the word itself.

The following example demonstrates how to perform case-sensitive search with a query in text form.

C#

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
 
Index index = new Index(indexFolder); // Creating index in the specified folder
index.Add(documentsFolder); // Indexing documents from the specified folder
 
SearchOptions options = new SearchOptions();
options.UseCaseSensitiveSearch = true; // Enabling case sensitive search
 
string query = "Windows";
SearchResult result = index.Search(query, options); // Searching

The next example demonstrates how to perform case-sensitive search with a query in object form.

C#

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";
 
Index index = new Index(indexFolder); // Creating index in the specified folder
index.Add(documentsFolder); // Indexing documents from the specified folder
 
SearchOptions options = new SearchOptions();
options.UseCaseSensitiveSearch = true; // Enabling case sensitive search
 
SearchQuery query = SearchQuery.CreateWordQuery("Windows"); // Creating search query in object form
 
SearchResult result = 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:

Free online document search App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to search over your PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX and more with our free online Free Online Document Search App.