GroupDocs Maven 依存関係: Java 検索ネットワークの構成と同期
この包括的なガイドでは、GroupDocs Maven 依存関係をプロジェクトに追加し、GroupDocs.Search を使用して堅牢な Java 検索ネットワークを構成する方法を紹介します。法務文書、財務レポート、学術論文を扱う場合でも、以下の手順でインデックス作成、検索、シャードの同期を効率的に行うことができます。
Introduction
膨大なドキュメントコレクションの管理と検索は、多くの組織の設定のデンスのためのシャード同期手順を順に解説します。
Quick Answers
- GroupDocs Maven 依存関係とは? Maven アーティファクトで、GroupDocs.Search ライブラリを Java プロジェクトに取り込みます。
- 検索ネットワークを使用する理由は? インデックス作成とクエリ負荷を複数ノードに分散し、速度と信頼性を向上させます。
- ディレクトリをインデックスに追加する方法は? マスターノードで
IndexingDocuments.addDirectoriesを使用します。 - シャードを同期する方法は? 各ノードの
IndexerでSynchronizeOptionsを呼び出します。 - ライセンスは必要ですか? はい、商用利用にはトライアルまたは商用ライセンスが必要です。
What is the GroupDocs Maven Dependency?
GroupDocs Maven 依存関係(com.groupdocs:groupdocs-search)は、検索可能なインデックスの構築、ネットワークノードの管理、迅速なクエリ実行に必要なすべてのクラスをパッケージ化しています。pom.xml に追加することで、Maven が正しいバイナリとトランジティブ依存関係を取得します。
How to Add the GroupDocs Maven Dependency
Maven Configuration
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>
Pro tip: 公式リリースページでバージョン番号を最新に保ちましょう。
公式サイトから JAR を直接ダウンロードすることもできます: GroupDocs.Search for Java releases。
Prerequisites
- JDK(11 以上)をインストール済み
- IntelliJ IDEA や Eclipse などの IDE
- 基本的な Java 知識、Maven の経験、ネットワークノード概念の理解
- 有効な GroupDocs.Search ライセンス(無料トライアルまたは商用)
Basic Initialization and Setup
インデックスディレクトリを作成します:
import com.groupdocs.search.SearchIndex;
import com.groupdocs.search.options.IndexingOptions;
// Create an index in the specified directory
SearchIndex index = new SearchIndex("YOUR_INDEX_DIRECTORY");
このシンプルな手順で、以降のネットワーク構成の準備が整います。
Implementation Guide
Feature 1: Configuration of Search Network
Overview
検索ネットワークの構成では、ノード間の通信に使用するファイルパスとポートを設定します。
Set Up Paths and Ports
import com.groupdocs.search.options.*;
import com.groupdocs.search.scaling.configuring.ConfiguringSearchNetwork;
// Set custom paths for input/output directories
String basePath = "YOUR_DOCUMENT_DIRECTORY/AdvancedUsage/Scaling/SynchronizingShards/";
int basePort = 49144; // Adjust if there's a port conflict
Configuration configuration = ConfiguringSearchNetwork.configure(basePath, basePort);
configuration オブジェクトに検索ネットワークに必要なすべての設定が格納されます。
Feature 2: Deploying Search Network Nodes
Overview
ノードをデプロイしてネットワーク全体にワークロードを分散します。マスターノードが操作とイベントを管理します。
Deployment Code
import com.groupdocs.search.scaling.*;
import com.groupdocs.search.options.Configuration;
SearchNetworkNode[] nodes = SearchNetworkDeployment.deploy(basePath, basePort, configuration);
// Retrieve the master node for further operations
SearchNetworkNode masterNode = nodes[0];
Feature 3: Subscribing to Search Network Node Events
Overview
イベントをリッスンすることで、ネットワーク内の変更や更新に動的に対応できます。
Subscription Implementation
import com.groupdocs.search.scaling.SearchNetworkNode;
import com.groupdocs.search.scaling.SearchNetworkNodeEvents;
SearchNetworkNodeEvents.subscribe(masterNode);
Feature 4: Adding Directories to Index
Overview
ディレクトリを追加することは、ドキュメントを検索可能にする核心的なステップです。
Document Addition
import com.groupdocs.search.indexing.IndexingDocuments;
import com.groupdocs.search.scaling.SearchNetworkNode;
IndexingDocuments.addDirectories(masterNode, "YOUR_DOCUMENT_DIRECTORY/DocumentsPath");
Feature 5: Synchronizing Shards in Search Network Node
Overview
同期はすべてのシャード間でデータの一貫性を保ちます。
Synchronization Code
import com.groupdocs.search.indexing.Indexer;
import com.groupdocs.search.scaling.SearchNetworkNode;
import com.groupdocs.search.options.SynchronizeOptions;
SearchNetworkNode node = null; // Assume 'node' is initialized as a SearchNetworkNode
def synchronizeShards(SearchNetworkNode node) {
Indexer indexer = node.getIndexer();
SynchronizeOptions options = new SynchronizeOptions();
indexer.synchronize(options);
}
Feature 6: Closing Search Network Nodes
Overview
ノードを適切に閉じることでリソースが解放され、メモリリークを防止します。
Node Closure
import com.groupdocs.search.scaling.SearchNetworkNode;
for (SearchNetworkNode node : nodes) {
node.close();
}
Practical Applications
- Legal Document Management – ケースファイルや判例を迅速に取得
- Financial Record Keeping – 明細書や監査トレイルに数秒でアクセス
- Academic Research – 数千件の論文を検索し、関連する引用を見つける
Performance Considerations
- Optimize Queries – 簡潔なクエリを書いて応答時間を短縮
- Memory Management – JVM ヒープ使用量を監視し、大規模インデックス向けに GC チューニングを検討
- Scaling Strategy – データ量とクエリ負荷に応じてノードを比例的に追加
Common Issues and Solutions
| Issue | Cause | Solution |
|---|---|---|
| Nodes fail to connect | Port conflict | basePort を未使用の値に変更 |
| Index not updating | Event subscription missing | SearchNetworkNodeEvents.subscribe(masterNode) が呼び出されていることを確認 |
| High latency | Insufficient shards | ノード数を増やし、ドキュメント分散を調整 |
Frequently Asked Questions
Q: What is the primary benefit of using GroupDocs.Search?
A: 大規模なドキュメントセットに対して、最小限の設定で高速かつスケーラブルな検索機能を提供します。
Q: Can I customize node configurations in a search network?
A: はい、Configuration オブジェクトを通じてカスタムパス、ポート、その他のオプションを設定できます。
Q: How do I add directories to index after the network is running?
A: 新しいフォルダーをインデックス化する必要があるときは、IndexingDocuments.addDirectories(masterNode, "path") を呼び出します。
Q: How to sync shards when a new node joins the network?
A: 上記の synchronizeShards メソッドを新規追加ノードで実行します。
Q: Do I need a license for development?
A: テストには無料トライアルライセンスで十分ですが、商用利用には商用ライセンスが必要です。
Conclusion
このガイドに従うことで、GroupDocs Maven 依存関係の追加、マルチノード検索ネットワークの構成、ディレクトリのインデックス化、シャードの同期方法を習得できました。これらの手順は、組織のニーズに合わせて拡張可能な高性能ドキュメント検索ソリューションの基盤となります。
Last Updated: 2026-01-21
Tested With: GroupDocs.Search 25.4
Author: GroupDocs