GroupDocs.Search for Java

Find phrases in documents

Quickly locate specific phrases with GroupDocs.Search for Java. Add powerful search functionality to your Java applications.

How to find phrases in DOCX documents

GroupDocs.Search simplifies phrase searching in DOCX documents. Use various options to refine search results in Java applications.

  1. Create a search index directory.
  2. Specify the folder with DOCX files.
  3. Adjust search parameters.
  4. Retrieve and analyze search results.
// Define the search index path
Index index = new Index("c:/MyIndex");

// Specify the folder containing documents
index.add("c:/MyDocuments");

// Set search preferences
SearchQuery word1 = SearchQuery.createWordQuery("lorem");
SearchQuery word2 = SearchQuery.createWordQuery("ipsum");
SearchQuery word3 = SearchQuery.createWordQuery("dolor");

SearchQuery query = SearchQuery.createPhraseSearchQuery(word1, word2, word3);

// Execute the search query
SearchResult result = index.search(query);
Maven XML
click to copy
copied
More examples Documentation

Explore Java document search engine

GroupDocs.Search for Java allows phrase searches across 70+ file formats. Easily find and organize data using advanced search features.

Key capabilities of GroupDocs.Search

Phrase search

Locate exact phrases in business documents, such as PDFs, Word files, presentations, and spreadsheets. Use wildcards and other options when the exact phrase is unknown.

Optimized data indexing

Speed up document searches by creating and reusing search indexes. Indexing organizes data efficiently for faster and more accurate searches.

Multi-language compatibility

Search documents in over 80 languages. Supports different keyboard layouts and morphological analysis to improve search precision.

Advanced search options

Customize searches with case sensitivity, fuzzy search, homophone matching, document filtering, and other powerful features.

Utilizing advanced search methods

Learn how to construct queries for searching in DOCX.

Java

// Define the directory for the search index
Index index = new Index("c:/MyIndex");
    
// Set the path to the target documents
index.add("c:/MyDocuments");

// Create a search query for a specific phrase
SearchQuery word1 = SearchQuery.createWordQuery("Lorem");
SearchQuery wildcard = SearchQuery.createWildcardQuery(1, 7);
SearchQuery word2 = SearchQuery.createWordQuery("dolor");

SearchQuery query = SearchQuery.createPhraseSearchQuery(word1, wildcard, word2);

// Fetch the search results
SearchResult result = index.search(query);

// Process and utilize the retrieved results
System.out.println("Documents: " + result.getDocumentCount());
System.out.println("Occurrences: " + result.getDocumentCount());
Maven XML
click to copy
copied
More examples Documentation

GroupDocs.Search features

GroupDocs.Search for Java is a robust library for indexing and searching text within documents. It supports over 70 file formats, including PDFs, Word documents, Excel spreadsheets, images, and ZIP files, ensuring fast and precise search results.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Search for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Advanced search capabilities

Utilize cutting-edge search functionalities for improved accuracy and performance.

Search phrases in business documents

GroupDocs.Search enables phrase searches in 70+ document formats. Leverage advanced options and indexing for efficient searches.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English