Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,44 +1,105 @@
---
title: "Add documents to index: case‑sensitive Java search with GroupDocs"
description: "Learn how to add documents to index and enable case sensitive search in Java with GroupDocs.Search, boosting accuracy of your application."
date: "2026-02-06"
weight: 1
url: "/java/searching/master-case-sensitive-searches-java-groupdocs/"
date: '2026-08-10'
description: Learn how to create searchable index java and enable casesensitive search
with GroupDocs.Search, boosting accuracy for Java applications.
images:
- /java/searching/master-case-sensitive-searches-java-groupdocs/og-image.png
keywords:
- case-sensitive searches in Java
- GroupDocs.Search Java tutorial
- Java text query search
- object query search in Java
- create searchable index java
- case sensitive search java
- groupdocs search java tutorial
- java text query search
lastmod: '2026-08-10'
og_description: Learn how to create searchable index java and enable case‑sensitive
search with GroupDocs.Search. Step‑by‑step guide for Java developers.
og_image_alt: Guide to creating a searchable index in Java using GroupDocs with case‑sensitive
search
og_title: 'Create searchable index java: add docs case‑sensitive search'
schemas:
- author: GroupDocs
dateModified: '2026-08-10'
description: Learn how to create searchable index java and enable case‑sensitive
search with GroupDocs.Search, boosting accuracy for Java applications.
headline: 'Create searchable index java: add docs case‑sensitive search'
type: TechArticle
- description: Learn how to create searchable index java and enable case‑sensitive
search with GroupDocs.Search, boosting accuracy for Java applications.
name: 'Create searchable index java: add docs case‑sensitive search'
steps:
- name: create an index and add your documents
text: The `Index` class represents a searchable storage area on disk where documents
are indexed. > **Pro tip:** You can call `index.add()` multiple times to **search
across multiple directories** in a single index.
- name: enable case‑sensitive search
text: '`SearchOptions` configures how queries are processed, including case sensitivity
and other search behaviors.'
- name: execute a case‑sensitive text query
text: '`SearchQuery` builds the query object that the engine evaluates against
the index. The loop prints the full path of each document that contains the
exact case‑matched term.'
- name: initialize a second index (optional)
text: A second `Index` instance can be created to isolate object‑based searches
from plain‑text searches.
- name: re‑use the case‑sensitive option
text: '`SearchOptions` can be reused across different query types to maintain
consistent case handling.'
- name: build and run an object query
text: '`WordQuery` represents a word‑level search that can be combined with other
query types for complex searches. Using `createWordQuery` lets you later combine
it with phrase, wildcard, or Boolean queries for more complex scenarios.'
type: HowTo
- questions:
- answer: Add documents to an index with `index.add(...)`.
question: What is the primary step to start searching?
- answer: Set `options.setUseCaseSensitiveSearch(true)`.
question: How do you enable case‑sensitive search?
- answer: Yes – call `index.add()` for each folder you want to include.
question: Can you search across multiple directories?
- answer: Use `SearchQuery.createWordQuery(...)`.
question: Which method lets you search with objects?
- answer: A temporary license is available for trial purposes.
question: Do you need a license for testing?
type: FAQPage
tags:
- create searchable index
- case-sensitive search
- groupdocs search
- java document processing
title: 'Create searchable index java: add docs case‑sensitive search'
type: docs
url: /java/searching/master-case-sensitive-searches-java-groupdocs/
weight: 1
---

# Add documents to index: Mastering Case‑Sensitive Searches in Java with GroupDocs
# Create searchable index java: add docs case‑sensitive search

Retrieving the right piece of information from a massive collection of documents is a core requirement for modern applications. In this guide, you’ll learn **how to add documents to index** and perform **case‑sensitive searches** using GroupDocs.Search for Java. Whether you’re building a legal‑document repository, an e‑commerce catalog, or a content‑management system, precise search results keep users happy and your data trustworthy.
In modern Java applications, **creating a searchable index java** is the foundation for fast, accurate retrieval of information from large document collections. This tutorial shows you how to add documents to an index, enable case‑sensitive search, and fine‑tune the process with GroupDocs.Search. Whether you’re building a legal repository, an e‑commerce catalog, or a content‑management system, these steps will help you deliver precise results that keep users satisfied.

## Quick Answers
- **What is the primary step to start searching?** Add documents to an index with `index.add(...)`.
- **How to enable case sensitive search?** Set `options.setUseCaseSensitiveSearch(true)`.
- **Can I search across multiple directories?** Yes – call `index.add()` for each folder you want to include.
- **Which method lets me search with objects?** Use `SearchQuery.createWordQuery(...)`.
- **Do I need a license for testing?** A temporary license is available for trial purposes.
## Quick answers
- **What is the primary step to start searching?** Add documents to an index with `index.add(...)`.
- **How do you enable casesensitive search?** Set `options.setUseCaseSensitiveSearch(true)`.
- **Can you search across multiple directories?** Yes – call `index.add()` for each folder you want to include.
- **Which method lets you search with objects?** Use `SearchQuery.createWordQuery(...)`.
- **Do you need a license for testing?** A temporary license is available for trial purposes.

## What does “add documents to index” mean?
Adding documents to an index means feeding your source files (PDFs, Word docs, plain text, etc.) into GroupDocs.Search so it can build a searchable data structure. Once indexed, the engine can execute fast queries, including case‑sensitive ones.
Adding documents to an index means feeding your source files (PDFs, Word docs, plain text, etc.) into GroupDocs.Search so it can build a searchable data structure. The index stores tokenized terms, positions, and metadata, allowing the engine to execute fast queries, including case‑sensitive ones, and to rank results efficiently.

## Why enable case‑sensitive search in Java?
- **Exact term matching** – differentiate “Apple” (the company) from “apple” (the fruit).
- **Regulatory compliance** – some industries require exact phrase matching.
- **Improved relevance** – users often expect case‑specific results in technical or legal contexts.
Enabling case‑sensitive search ensures that the engine distinguishes between terms that differ only by letter case, which is critical for domains where capitalization carries meaning. It allows exact term matching, supports regulatory compliance requirements, and improves relevance by returning results that precisely match the user's query case.

- **Exact term matching** – e.g., “Apple” (company) vs. “apple” (fruit).
- **Regulatory compliance** – many industries require precise phrase matching.
- **Improved relevance** – technical and legal users often expect case‑specific results.

## Prerequisites
- JDK (Java 17 or later recommended)
- JDK 17 or later (recommended)
- Maven for dependency management
- An IDE such as IntelliJ IDEA or Eclipse
- Basic familiarity with Java programming

## Setting Up GroupDocs.Search for Java
First, add the GroupDocs repository and dependency to your `pom.xml`:
## Setting up GroupDocs.Search for Java
The following Maven snippet adds the GroupDocs.Search repository and the required dependency to your project.

```xml
<repositories>
Expand All @@ -63,10 +124,10 @@ Alternatively, you can download the latest version directly from [GroupDocs.Sear
### Licensing
To get started with a trial, visit GroupDocs to acquire a temporary license. This will allow you to test all features without any limitations.

## How to add documents to index – Text Query Search
## How to create searchable index java – text query search

### Step 1: Create an Index and add your documents
Create a folder where the index files will be stored, then add the source directory that contains the documents you want to search.
### Step 1: create an index and add your documents
The `Index` class represents a searchable storage area on disk where documents are indexed.

```java
String indexFolder = YOUR_OUTPUT_DIRECTORY + "/CaseSensitiveSearch/QueryInTextForm";
Expand All @@ -76,16 +137,16 @@ index.add(YOUR_DOCUMENT_DIRECTORY); // Add documents to the index

> **Pro tip:** You can call `index.add()` multiple times to **search across multiple directories** in a single index.

### Step 2: Enable case‑sensitive search
Configure the search options to respect letter casing.
### Step 2: enable case‑sensitive search
`SearchOptions` configures how queries are processed, including case sensitivity and other search behaviors.

```java
SearchOptions options = new SearchOptions();
options.setUseCaseSensitiveSearch(true);
```

### Step 3: Execute a case‑sensitive text query
Run a query that differentiates “Advantages” from “advantages”.
### Step 3: execute a case‑sensitive text query
`SearchQuery` builds the query object that the engine evaluates against the index.

```java
String query = "Advantages";
Expand All @@ -99,29 +160,27 @@ for (FoundDocument doc : result.getDocuments()) {

The loop prints the full path of each document that contains the exact case‑matched term.

## How to add documents to index – Object Query Search

Object queries give you more flexibility, especially when you need to combine multiple criteria.
## How to create searchable index java – object query search

### Step 1: Initialize a second index (optional)
If you prefer to keep object‑based searches separate, create another index folder.
### Step 1: initialize a second index (optional)
A second `Index` instance can be created to isolate object‑based searches from plain‑text searches.

```java
String indexFolder = YOUR_OUTPUT_DIRECTORY + "/CaseSensitiveSearch/QueryInObjectForm";
Index index = new Index(indexFolder);
index.add(YOUR_DOCUMENT_DIRECTORY); // Add documents to the index
```

### Step 2: Re‑use the case‑sensitive option
The same `SearchOptions` instance works for object queries.
### Step 2: re‑use the case‑sensitive option
`SearchOptions` can be reused across different query types to maintain consistent case handling.

```java
SearchOptions options = new SearchOptions();
options.setUseCaseSensitiveSearch(true);
```

### Step 3: Build and run an object query
Create a word query object and pass it to the search engine.
### Step 3: build and run an object query
`WordQuery` represents a word‑level search that can be combined with other query types for complex searches.

```java
SearchQuery query = SearchQuery.createWordQuery("Advantages");
Expand All @@ -135,24 +194,24 @@ for (FoundDocument doc : result.getDocuments()) {

Using `createWordQuery` lets you later combine it with phrase, wildcard, or Boolean queries for more complex scenarios.

## Practical Applications
- **Legal Document Management:** Retrieve case‑specific statutes where capitalization matters.
- **E‑commerce Platforms:** Distinguish product SKUs like “PRO‑X” vs. “pro‑x”.
- **Content Management Systems (CMS):** Ensure authors find exact headings or tags.
## Practical applications
- **Legal document management:** Retrieve case‑specific statutes where capitalization matters.
- **E‑commerce platforms:** Distinguish product SKUs like “PRO‑X” vs. “pro‑x”.
- **Content management systems (CMS):** Ensure authors find exact headings or tags.

## Performance Considerations
## Performance considerations
- **Keep the index up‑to‑date** – re‑index when new files are added or existing ones change.
- **Monitor memory usage** – large corpora benefit from incremental indexing and proper JVM heap sizing.
- **Leverage Java’s garbage collector** – release `Index` objects when they’re no longer needed.

## Common Issues and Solutions
## Common issues and solutions
| Issue | Solution |
|-------|----------|
| `useCaseSensitiveSearch` appears ignored | Verify you are using the latest GroupDocs.Search version and that the index was rebuilt after changing the option. |
| No results returned for a known term | Ensure the term’s case matches exactly and that the document was successfully added to the index. |
| Searching many folders slows down | Add each folder individually with `index.add()` and consider splitting the index into shards for very large datasets. |

## Frequently Asked Questions
## Frequently asked questions

**Q:** How do I handle large datasets with GroupDocs.Search?
**A:** Utilize index partitioning, tune JVM memory settings, and periodically compact the index to keep performance optimal.
Expand All @@ -171,16 +230,22 @@ Using `createWordQuery` lets you later combine it with phrase, wildcard, or Bool

## Resources
- **Documentation:** [GroupDocs.Search Java Docs](https://docs.groupdocs.com/search/java/)
- **API Reference:** [Java API Reference](https://reference.groupdocs.com/search/java)
- **API reference:** [Java API Reference](https://reference.groupdocs.com/search/java)
- **Download:** [Latest Releases](https://releases.groupdocs.com/search/java/)
- **GitHub Repository:** [GroupDocs.Search for Java](https://github.com/groupdocs-search/GroupDocs.Search-for-Java)
- **Support Forum:** [GroupDocs Free Support](https://forum.groupdocs.com/c/search/10)
- **Temporary License:** [Acquire a Temporary License](https://purchase.groupdocs.com/temporary-license/)
- **GitHub repository:** [GroupDocs.Search for Java](https://github.com/groupdocs-search/GroupDocs.Search-for-Java)
- **Support forum:** [GroupDocs Free Support](https://forum.groupdocs.com/c/search/10)
- **Temporary license:** [Acquire a Temporary License](https://purchase.groupdocs.com/temporary-license/)

---

**Last Updated:** 2026-02-06
**Last Updated:** 2026-08-10
**Tested With:** GroupDocs.Search 25.4
**Author:** GroupDocs

---
---

## Related Tutorials

- [Create Search Index Java – GroupDocs.Search Tutorials](/search/java/indexing/)
- [How to Add Documents to Index with GroupDocs.Search for Java](/search/java/indexing/implement-document-indexing-groupdocs-search-java/)
- [How to add documents to index with Metadata Indexing in Java using GroupDocs.Search](/search/java/indexing/groupdocs-search-java-metadata-indexing/)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading