Delete Index and Execute Full‑Text Search Using GroupDocs.Search for Java
In today’s data‑driven world, how to delete index quickly while still delivering lightning‑fast full‑text search Java capabilities is a competitive advantage. Whether you’re building an internal knowledge base, a legal‑case repository, or an e‑commerce product catalog, a well‑tuned search network can dramatically improve user satisfaction. In this guide you’ll learn how to set up a search network, create a searchable index, optimize search performance, and delete documents from the index when needed—all using GroupDocs.Search for Java.
Quick Answers
- What is the main purpose of GroupDocs.Search for Java? It provides full‑text search across 50+ document formats, enabling rapid keyword retrieval.
- How do I perform text search in a distributed environment? Deploy a search network, index documents on a master node, then query any node.
- Can I delete documents from the index without rebuilding it? Yes, use the Delete API to remove selected files, effectively how to delete index without full re‑indexing.
- What Java version is required? JDK 8 or higher.
- Is a license needed for production? A valid GroupDocs.Search license is required; a free trial is available.
What is “perform text search”?
Performing text search means querying a full‑text index to retrieve documents that contain the specified keywords or phrases. GroupDocs.Search builds an inverted index that makes these look‑ups extremely fast, even across thousands of files.
Why set up a search network?
A search network distributes indexing and query workloads across multiple nodes, allowing you to optimize search performance, scale horizontally, and maintain high availability. This architecture is ideal for enterprise‑level document repositories where latency and throughput matter.
How to Implement and Optimize a Search Network with GroupDocs.Search for Java
Load your configuration, start a master node, and then add worker nodes that share the same base path and port. Deploying the network this way lets any node handle indexing or query requests, delivering consistent response times even as the document count grows into the hundreds of thousands.
Step‑by‑step overview
- Define a base configuration that includes a shared directory and a TCP port.
- Start the master node to manage the index and coordinate worker nodes.
- Add worker nodes that connect to the master, enabling parallel indexing and searching.
- Monitor resource usage and tune JVM heap settings to keep latency low.
How to Delete Index in GroupDocs.Search for Java
SearchNode represents a node in the GroupDocs.Search network that manages indexing and query operations. The delete method removes specified documents from the index.
Direct deletion steps
- Call the
deletemethod on theSearchNodeinstance. - Provide an array of relative file paths.
- Commit the changes; the index is instantly refreshed and subsequent searches no longer return the removed files.
What is a Search Network?
A search network is a cluster of interconnected nodes that share a common index repository, allowing distributed indexing and query execution. It enables horizontal scaling and fault tolerance for large‑scale document collections.
How to Create Searchable Index (index documents java)
add method indexes a document into the search index. Add documents to the master node using the add method; the network propagates the changes to all worker nodes. This approach ensures that every node can serve queries against the most recent index without additional synchronization steps.
Key actions
- Point the master node to the folder containing source files.
- Invoke the indexing routine; the network processes each file and updates the inverted index.
- Verify that the index files appear in the designated storage directory.
How to Remove Indexed Files (remove indexed files)
When a document becomes obsolete, call the delete API with its path. The system removes the file’s entries from the inverted index, freeing storage and preventing stale results.
Setting up GroupDocs.Search for java
To begin, integrate GroupDocs.Search into your Java project using the following setup:
Maven Setup
Add the repository and dependency to your pom.xml file:
<repositories>
<repository>
<id>repository.groupdocs.com</id>
<name>GroupDocs Repository</name>
<url>https://releases.groupdocs.com/search/java/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-search</artifactId>
<version>25.4</version>
</dependency>
</dependencies>
Direct Download
Alternatively, you can download the latest version directly from GroupDocs.
License Acquisition
GroupDocs offers a free trial, which allows you to evaluate its features before purchase. You can obtain a temporary license by following the steps on their purchase page. This will enable full functionality during your testing phase.
Basic initialization and setup
Initialize GroupDocs.Search in your Java application with:
import com.groupdocs.search.*;
class SearchNetworkSetup {
public static void main(String[] args) {
Index index = new Index("path/to/index/directory");
// Additional configuration can be set here.
}
}
Implementation Guide
Configuring the Search Network
Overview: Establish a base path and port for your search network, allowing nodes to communicate effectively.
Step 1: define base configuration
import com.groupdocs.search.options.*;
import com.groupdocs.search.scaling.configuring.*;
String basePath = "YOUR_DOCUMENT_DIRECTORY/output/AdvancedUsage/Scaling/DeletingDocuments/";
int basePort = 49104; // Change if necessary.
Configuration configuration = ConfiguringSearchNetwork.configure(basePath, basePort);
- Parameters:
basePath: Directory path for network operations.basePort: Port number used by the search network.
Step 2: troubleshooting
Ensure that your specified port is not blocked by firewall settings or being used by another application. Adjust as necessary to avoid conflicts.
Deploying search network nodes
Overview: Using your configuration, deploy nodes across your network for distributed indexing and searching.
import com.groupdocs.search.scaling.*;
String basePath = "YOUR_DOCUMENT_DIRECTORY/output/AdvancedUsage/Scaling/DeletingDocuments/";
int basePort = 49104;
Configuration configuration = ConfiguringSearchNetwork.configure(basePath, basePort);
SearchNetworkNode[] nodes = SearchNetworkDeployment.deploy(basePath, basePort, configuration);
// Nodes are now deployed and ready for further operations.
- Key Configuration Options:
- Base Path & Port: These values should match those used in your initial configuration to ensure consistency.
Indexing Documents (create searchable index)
Overview: Add documents to the search index efficiently using a master node.
import com.groupdocs.search.scaling.*;
String documentsPath = "YOUR_DOCUMENT_DIRECTORY/path/to/documents";
SearchNetworkNode masterNode = nodes[0];
IndexingDocuments.addDirectories(masterNode, documentsPath);
- Purpose:
masterNode: The primary node managing document indexing.documentsPath: Path to the directory containing documents.
Troubleshooting Tips
Verify that your document paths are correct and accessible. Ensure permissions allow reading from these directories.
Searching Text in Network (perform text search)
Overview: Perform comprehensive text searches across your indexed network.
import com.groupdocs.search.scaling.*;
String query = "nulla";
SearchNetworkNode masterNode = nodes[0];
TextSearchInNetwork.searchAll(masterNode, query, false);
- Parameters:
query: The text you’re searching for.masterNode: Node conducting the search.
Deleting Documents from Index (delete documents index)
Overview: Remove specific documents from your index using their file paths.
import com.groupdocs.search.scaling.*;
SearchNetworkNode node = nodes[0];
String[] filePaths = {
"YOUR_DOCUMENT_DIRECTORY/SampleDocument.pdf",
"YOUR_DOCUMENT_DIRECTORY/SampleDocument.docx"
};
deleteDocuments(node, filePaths);
void deleteDocuments(SearchNetworkNode node, String... filePaths) {
Indexer indexer = node.getIndexer();
DeleteOptions options = new DeleteOptions();
indexer.delete(filePaths, options);
}
- Method Purpose:
node: The target node for deletion operations.filePaths: Paths of documents to be removed from the index.
Troubleshooting
Ensure file paths are precise and that files exist in your directory. If issues persist, check network permissions and connectivity.
Practical Applications
- Enterprise Document Management: Streamline internal knowledge retrieval.
- Legal Case Analysis: Quickly locate relevant case files across multiple repositories.
- E‑commerce Platforms: Boost product search speed by indexing descriptions and reviews.
- Academic Research: Efficiently search large digital libraries of papers and theses.
- Customer Support Systems: Reduce response time by enabling agents to search past tickets instantly.
Performance Considerations
- Optimize Indexing Speed: Incrementally add new documents during off‑peak hours to keep latency low.
- Resource Usage Guidelines: Monitor CPU and memory, especially when scaling the number of nodes.
- Java Memory Management: Tune JVM heap settings based on your workload (e.g.,
-Xmx2gfor medium‑size indexes).
Conclusion
By following this guide you’ve learned how to set up a search network, create a searchable index, perform text search, and delete documents index using GroupDocs.Search for Java. These capabilities enable fast, reliable document retrieval across distributed environments.
Next Steps
- Experiment with different node configurations to find the optimal balance for your workload.
- Dive deeper into advanced indexing options such as custom analyzers and relevance tuning.
- Explore integration with other GroupDocs products for end‑to‑end document processing.
Frequently asked questions
Q: What is the primary use case for GroupDocs.Search for Java?
A: It provides full‑text search across many document formats, allowing you to perform text search in large repositories.
Q: How can I improve search speed in a large network?
A: Deploy additional nodes, tune the JVM heap, and schedule indexing during low‑traffic periods to optimize search performance.
Q: Is it possible to delete a single document without re‑indexing the whole collection?
A: Yes, use the delete documents index API as shown in the code example to remove specific files.
Q: Do I need a license for development?
A: A free trial license is sufficient for testing; a commercial license is required for production deployments.
Q: Can I index PDFs, Word files, and emails together?
A: Absolutely—GroupDocs.Search supports a wide range of formats out of the box.
Last Updated: 2026-07-07
Tested With: GroupDocs.Search for Java 25.4
Author: GroupDocs