GroupDocs.Search for Java के साथ दस्तावेज़ों को इंडेक्स कैसे करें
आज के डेटा‑चालित विश्व में, how to index documents को कुशलता से करना किसी भी जावा डेवलपर के लिए एक महत्वपूर्ण कौशल है जो बड़ी फ़ाइल संग्रहों को संभालता है। चाहे आप कानूनी अनुबंध, वित्तीय विवरण, या आंतरिक रिपोर्ट्स को प्रोसेस कर रहे हों, एक अच्छी तरह निर्मित सर्च इंडेक्स आपको सेकंडों में सटीक जानकारी खोजने में मदद करता है, जबकि मैन्युअल स्कैनिंग में घंटे लगते हैं। यह ट्यूटोरियल आपको सर्च इंडेक्स बनाने, दस्तावेज़ जोड़ने, और GroupDocs.Search for Java के साथ टेक्स्ट‑आधारित और ऑब्जेक्ट‑आधारित क्वेरी चलाने की प्रक्रिया दिखाता है।
त्वरित उत्तर
- दस्तावेज़ों को इंडेक्स करने का पहला कदम क्या है? Create an
Indexinstance that points to a folder where the index files will be stored. - इंडेक्स में दस्तावेज़ जोड़ने की कौन सी विधि है? Call
index.add("PATH_TO_DOCUMENTS")to scan a directory and ingest supported files. - क्या मैं संख्यात्मक रेंज खोज सकता हूँ? Yes – use a text query like
"400 ~~ 4000"or an object query viaSearchQuery.createNumericRangeQuery. ThecreateNumericRangeQuerymethod builds a numeric range query object. - क्या मुझे लाइसेंस की आवश्यकता है? A free trial works for evaluation; a commercial license unlocks full feature set and removes usage limits.
- कौन सा जावा संस्करण आवश्यक है? JDK 8 or higher is supported.
GroupDocs.Search के साथ दस्तावेज़ों को इंडेक्स कैसे करें क्या है?
दस्तावेज़ों को इंडेक्स करने से प्रत्येक फ़ाइल के लिए एक सर्चेबल टोकन स्टोर बनता है, जिससे इंजन को हर बार मूल फ़ाइलें पढ़े बिना मिलान खोजने की सुविधा मिलती है। यह प्री‑प्रोसेसिंग चरण कच्ची सामग्री को एक अनुकूलित इंडेक्स में बदल देता है जिसे मिलीसेकंड में क्वेरी किया जा सकता है। इंडेक्स शब्द, स्थितियाँ और मेटाडेटा संग्रहीत करता है, जिससे सभी समर्थित दस्तावेज़ प्रकारों में तेज़ फ़्रेज़ और प्रॉक्सिमिटी सर्च संभव हो जाता है।
GroupDocs.Search for Java का उपयोग क्यों करें?
सर्च ऑपरेशन आमतौर पर 10 000 फ़ाइलों (औसत 1 KB प्रत्येक) के संग्रह पर 50 ms से कम समय में पूरा हो जाता है, जो एक मानक 2‑CPU, 8 GB VM पर चलता है। लाइब्रेरी 30+ इनपुट और आउटपुट फ़ॉर्मेट को सपोर्ट करती है—PDF, DOCX, XLSX, PPTX, TXT, और HTML सहित—जिससे आप अतिरिक्त कन्वर्टर्स के बिना लगभग किसी भी व्यावसायिक दस्तावेज़ को इंडेक्स कर सकते हैं। इसका लचीला API आपको प्लेन‑टेक्स्ट क्वेरी, संख्यात्मक रेंज, और जटिल ऑब्जेक्ट क्वेरी को मिलाने देता है, जबकि इन्क्रीमेंटल अपडेट्स आपको पूरे इंडेक्स को फिर से बनाने की आवश्यकता के बिना नई फ़ाइलें जोड़ने की अनुमति देते हैं।
पूर्वापेक्षाएँ
- Maven installed for dependency management.
- An IDE such as IntelliJ IDEA or Eclipse.
- Basic Java knowledge (OOP concepts, exception handling).
GroupDocs.Search for Java सेटअप करना
Maven सेटअप
Add the repository and dependency to your pom.xml:
<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>
सीधे डाउनलोड
You can also download the latest JAR from GroupDocs.Search for Java releases.
लाइसेंस प्राप्त करने के चरण
- Free trial – explore the library without cost.
- Temporary license – request a short‑term key for extended evaluation.
- Purchase – obtain a full license for production use.
बुनियादी आरंभिककरण और सेटअप
To add documents to the index, you first create an Index object that points to the folder where the index files will be stored:
Index is the core class that represents a searchable index on disk.
import com.groupdocs.search.Index;
// Initialize the index by specifying a directory path
Index index = new Index("YOUR_DOCUMENT_DIRECTORY\\output\\AdvancedUsage\\Searching\\NumericRangeSearch");
This line creates (or opens) an index ready to receive documents.
कार्यान्वयन गाइड
दस्तावेज़ बनाना और इंडेक्स करना
इंडेक्स में दस्तावेज़ कैसे जोड़ें
The add method scans a folder and stores searchable data for each file. It recursively processes every supported document, extracts text and metadata, and writes tokens to the index folder you specified earlier.
import com.groupdocs.search.Index;
// Initialize an index at the specified path
Index index = new Index("YOUR_DOCUMENT_DIRECTORY\\output\\AdvancedUsage\\Searching\\NumericRangeSearch");
// Add documents from a directory for indexing
index.add("YOUR_DOCUMENT_DIRECTORY");
- Parameters: The path string points to the folder containing the files you want to index.
- Purpose: After this step, the index contains tokens from all supported document types, enabling rapid searches across the entire collection.
टेक्स्ट क्वेरी खोज
टेक्स्ट‑आधारित संख्यात्मक रेंज खोज कैसे करें
You can search using a simple string that defines a range. The engine interprets the ~~ operator as “between” and returns all documents containing numbers within the specified limits.
import com.groupdocs.search.*;
import com.groupdocs.search.results.*;
// Define a query for numeric values within a specific range
String query1 = "400 ~~ 4000";
// Execute text-based search on indexed data
SearchResult result1 = index.search(query1);
- Parameters: The query string
"400 ~~ 4000"tells the engine to find numbers between 400 and 4000. - Return value:
SearchResultholds the list of matching documents and highlights the matching fragments.
ऑब्जेक्ट क्वेरी खोज
संख्यात्मक रेंज के लिए ऑब्जेक्ट क्वेरी कैसे उपयोग करें
Object‑based queries give you programmatic control over search criteria, allowing you to combine multiple conditions or build queries dynamically at runtime.
import com.groupdocs.search.*;
import com.groupdocs.search.results.*;
// Create a numeric range query object
SearchQuery query2 = SearchQuery.createNumericRangeQuery(400, 4000);
// Perform search using the query object
SearchResult result2 = index.search(query2);
- Parameters:
createNumericRangeQueryreceives the start and end integers. - Purpose: This method is ideal when you need to filter results by numeric fields such as invoice totals, ages, or product codes.
व्यावहारिक अनुप्रयोग
Here are some real‑world scenarios where how to index documents becomes a game‑changer:
- Legal document management – locate clauses, case numbers, or dates across thousands of contracts in seconds.
- Financial reporting – pull transactions that fall within a specific monetary range without scanning each spreadsheet.
- Inventory tracking – find items by serial numbers, batch codes, or SKU ranges across a distributed file system.
Integrating GroupDocs.Search with databases, cloud storage, or messaging queues can further automate document workflows.
प्रदर्शन संबंधी विचार
- Regular index updates: Re‑run
index.addfor new files to keep the index fresh. - Resource management: Monitor heap usage; large indexes benefit from tuned JVM garbage‑collection settings.
- Query optimisation: Use object queries for complex filters to reduce unnecessary scanning and improve response time.
सामान्य समस्याएँ और समाधान
| समस्या | क्यों होता है | समाधान |
|---|---|---|
| Search returns no results | Index not built or folder path incorrect | Verify index.add executed on the correct directory and that the index folder is writable. |
| OutOfMemoryError during indexing | Very large files or insufficient heap | Increase JVM -Xmx value or index files in smaller batches. |
| Unsupported file format | File type not recognised by GroupDocs.Search | Ensure the extension is among the supported list (PDF, DOCX, XLSX, PPTX, TXT, HTML, etc.). |
अक्सर पूछे जाने वाले प्रश्न
Q: How do I update an existing index with new documents?
A: Call index.add("NEW_DOCUMENT_PATH") again; the library merges the new entries without recreating the whole index.
Q: Can GroupDocs.Search handle different file formats?
A: Yes, it supports 30+ formats—including PDF, DOCX, XLSX, PPTX, TXT, and HTML—so you can index virtually any business document.
Q: What are the system requirements for using GroupDocs.Search?
A: Java 8+ runtime, at least 2 GB RAM for modest collections (larger sets benefit from 4 GB+), and read/write access to the index folder.
Q: How can I troubleshoot search performance issues?
A: Keep the index up‑to‑date, profile your queries, and review JVM memory settings. Reducing the number of indexed fields or using object queries can also speed up execution.
Q: Is there support for synonyms or fuzzy matching?
A: Yes, you can enable synonym dictionaries and fuzzy search via the SearchOptions class to broaden matching without sacrificing relevance. The SearchOptions class configures advanced search behavior such as synonyms and fuzzy matching.
अंतिम अपडेट: 2026-08-10
परीक्षण किया गया: GroupDocs.Search 25.4 for Java
लेखक: GroupDocs