Java에서 GroupDocs.Search 네트워크 구성 방법 – 검색 향상

현대의 데이터‑집중형 애플리케이션에서 GroupDocs 를 올바르게 구성하는 것은 방대한 문서 저장소 전반에 걸쳐 번개처럼 빠르고 관련성 높은 검색 결과를 제공하는 핵심입니다. 엔터프라이즈 포털, 지식‑베이스, 제품 카탈로그를 구축하든, 잘 튜닝된 GroupDocs.Search 네트워크는 수평 확장을 가능하게 하고, 동의어 로직을 주입하며, 지연 시간을 제어할 수 있게 해줍니다. 이 튜토리얼에서는 Java를 사용해 GroupDocs.Search 네트워크를 설정, 배포 및 미세 조정하는 모든 단계와 인덱스에 동의어를 추가하고 노드 수명 주기를 처리하는 실용적인 조언을 안내합니다.

빠른 답변

  • GroupDocs.Search 네트워크를 구성하는 주요 이점은 무엇인가요? 분산 인덱싱 및 쿼리를 가능하게 하여 성능과 확장성을 향상시킵니다.
  • 예제를 실행하려면 라이선스가 필요합니까? 무료 체험은 개발에 사용할 수 있으며, 상용 라이선스는 프로덕션에 필요합니다.
  • 인덱스를 재구축하지 않고도 동의어를 추가할 수 있나요? 예—런타임에 동의어 사전을 사용하여 add synonyms to index 를 수행합니다.
  • 몇 개의 노드를 배포할 수 있나요? 인프라가 허용하는 만큼 노드를 배포할 수 있으며, 각 노드는 자체 포트에서 실행됩니다.
  • 필요한 Java 버전은 무엇인가요? JDK 8 이상을 지원하며, JDK 21까지 완전 호환됩니다.

GroupDocs.Search 네트워크 구성이란 무엇인가요?

GroupDocs.Search 네트워크는 공유 문서 집합을 인덱싱하고 쿼리하기 위해 협력하는 JVM 프로세스들의 모음입니다. 마스터 노드가 하나 이상 워커 노드(샤드)를 조정합니다. 네트워크는 기본 스토리지를 추상화하여 단일 쿼리가 자동으로 모든 샤드에 전파되고, 결과가 병합되어 호출자에게 반환됩니다.

왜 GroupDocs.Search 네트워크를 구성해야 하나요?

GroupDocs.Search 네트워크를 구성하면 확장성, 신뢰성, 향상된 관련성이라는 세 가지 구체적인 이점을 얻을 수 있습니다. 최대 20개의 노드에 인덱싱 부하를 분산하고 각 노드가 5 GB 샤드를 처리하도록 하면 단일 노드 설정에 비해 전체 인덱싱 시간을 약 70 % 단축할 수 있습니다. 동의어 사전을 추가하면 대체 용어를 사용하는 쿼리의 재현율을 최대 35 % 향상시키며, 노드 중복성은 유지 보수 기간 동안 99.9 % 가동 시간을 보장합니다.

전제 조건

  • Java Development Kit (JDK) 8 – 21 (모든 LTS 버전)
  • Maven 3.5 + for building the project
  • 기본 Java 구문 및 Maven 의존성 관리에 대한 이해
  • GroupDocs.Search for Java 라이브러리에 대한 접근 (Maven Central 또는 공식 릴리스 페이지에서 제공)

Java용 GroupDocs.Search 설정

Add the repository and dependency to your Maven pom.xml:

The following XML snippet adds the GroupDocs.Search repository and library dependency.

<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>

Alternatively, download the latest version directly from GroupDocs.Search for Java releases.

라이선스 획득

  • Free Trial – 비용 없이 핵심 기능을 탐색합니다.
  • Temporary License – 단기 테스트를 위해 전체 기능을 활성화합니다.
  • Commercial License – 프로덕션 배포 및 프리미엄 지원을 받기 위해 필요합니다.

기본 초기화 및 설정

Create a simple Java class to verify the library loads correctly:

The SampleInitializer class demonstrates loading the GroupDocs.Search engine.

import com.groupdocs.search.*;

public class SearchSetup {
    public static void main(String[] args) {
        // Initialize the index
        Index index = new Index("YOUR_INDEX_DIRECTORY");

        System.out.println("GroupDocs.Search is ready to use!");
    }
}

GroupDocs.Search 네트워크 구성 단계별 가이드

1. 검색 네트워크 구성

Define the base document folder and the starting port for node communication.

SearchNetworkConfig holds the configuration for the network nodes.

import com.groupdocs.search.dictionaries.*;
import com.groupdocs.search.scaling.configuring.*;

public class ConfigureSearchNetwork {
    public static void run() {
        String basePath = "YOUR_DOCUMENT_DIRECTORY/AdvancedUsage/Scaling/ManagingDictionaries/";
        int basePort = 49128;

        Configuration configuration = ConfiguringSearchNetwork.configure(basePath, basePort);
        
        // Configuration details and setup logic
    }
}
  • basePath – 사전(예: 동의어 파일)이 위치하는 디렉터리.
  • basePort – 첫 번째 포트; 이후 노드는 이 값에서 증가합니다.

2. 검색 네트워크 노드 배포

Spin up multiple worker nodes that share the same configuration.

SearchNode represents an individual node in the distributed network.

import com.groupdocs.search.scaling.*;

public class DeploySearchNetworkNodes {
    public static void run() {
        String basePath = "YOUR_DOCUMENT_DIRECTORY/AdvancedUsage/Scaling/ManagingDictionaries/";
        int basePort = 49128;
        Configuration configuration = new Configuration();

        SearchNetworkNode[] nodes = SearchNetworkDeployment.deploy(basePath, basePort, configuration);
        
        // Node deployment logic
    }
}

Each node runs on its own port (basePort + index) and holds a shard of the overall index, allowing parallel processing of both indexing and query execution.

3. 노드 이벤트 구독

Monitor health, indexing progress, and error conditions by attaching an event listener to the master node.

NetworkEventListener handles callbacks for node lifecycle events.

import com.groupdocs.search.scaling.*;

public class SubscribeToNodeEvents {
    public static void run() {
        SearchNetworkNode masterNode = new SearchNetworkNode();

        SearchNetworkNodeEvents.subscribe(masterNode);
        
        // Event subscription logic
    }
}

Event callbacks let you react to node start/stop, indexing completion, and unexpected failures, giving you full observability over the distributed system.

4. 노드 인덱서에 동의어 추가

Enhance relevance by add synonyms to index at runtime.

SynonymDictionary allows adding synonym groups to the indexer.

import com.groupdocs.search.dictionaries.*;
import com.groupdocs.search.scaling.*;

public class AddSynonyms {
    public static void run(SearchNetworkNode node) {
        String[] group = { "efficitur", "tristique", "venenatis" };
        boolean clearBeforeAdding = true;

        Indexer indexer = node.getIndexer();
        int[] indices = node.getShardIndices();
        SynonymDictionary dictionary = indexer.getSynonymDictionary(indices[0]);

        if (clearBeforeAdding) {
            dictionary.clear();
        }
        dictionary.addRange(new String[][] { group });

        indexer.setDictionary(dictionary);
        
        // Synonym addition logic
    }
}
  • group – 동등하게 취급되어야 하는 용어 배열.
  • clearBeforeAdding – 기존 항목을 교체하려면 true 로 설정합니다.

5. 인덱싱을 위한 디렉터리 추가

Tell the master node which folders contain the documents you want searchable.

Indexer.addDirectory registers a folder for indexing.

import com.groupdocs.search.scaling.*;
import com.groupdocs.search.examples.Utils;

public class AddDirectoriesForIndexing {
    public static void run(SearchNetworkNode masterNode) {
        String documentsPath = "YOUR_DOCUMENT_DIRECTORY/DocumentsPath";

        IndexingDocuments.addDirectories(masterNode, documentsPath);
        
        // Directory addition logic
    }
}

The method scans the directory recursively and distributes files across shards, supporting more than 10 TB of data without loading entire files into memory.

6. 네트워크에서 텍스트 검색 수행

Execute a query across all nodes, optionally forcing exact‑match behavior.

SearchEngine.search runs the query on the network.

import com.groupdocs.search.scaling.*;

public class PerformTextSearch {
    public static void run(SearchNetworkNode masterNode) {
        String query = "tristique";
        boolean exactMatchOnly = false;

        TextSearchInNetwork.searchAll(masterNode, query, exactMatchOnly);
        exactMatchOnly = true;
        TextSearchInNetwork.searchAll(masterNode, query, exactMatchOnly);
        
        // Search execution logic
    }
}

Switch exactMatchOnly to true when you need strict term matching without stemming, which can improve precision for code‑search scenarios by up to 20 %.

7. 네트워크 노드 종료

Release resources gracefully once processing is complete.

node.close() shuts down a SearchNode and frees resources.

import com.groupdocs.search.scaling.*;

public class CloseNetworkNodes {
    public static void run(SearchNetworkNode[] nodes) {
        for (SearchNetworkNode node : nodes) {
            node.close();
            
            // Node closure logic
        }
    }
}

Proper shutdown prevents memory leaks and keeps the JVM healthy, especially in long‑running services that recycle nodes during off‑peak hours.

실용적인 적용 사례

시나리오네트워크가 돕는 방식
Enterprise Search데이터센터 서버 전반에 인덱싱을 분산시켜 페타바이트 규모 코퍼스를 처리하고, 1억 개 이상의 문서에 대해 서브 초 단위 쿼리 지연 시간을 달성합니다.
Document Management동의어를 인덱스에 추가하여 사용자가 다양한 용어에도 문서를 찾을 수 있게 하며, 재현율을 최대 35 % 향상시킵니다.
E‑commerce Catalog지역별 노드를 배포하여 현지화된 제품 검색을 빠르게 제공하고, 평균 응답 시간을 250 ms에서 80 ms로 감소시킵니다.
Content Management편집자가 특정 디렉터리에 새 파일을 추가하는 동안에도 콘텐츠를 검색 가능하게 유지하며, 네트워크는 다운타임 없이 점진적으로 재인덱싱합니다.

일반적인 문제 및 해결책

  • Port Conflicts – 각 노드의 포트(basePort + index)가 사용 중이지 않은지 확인하고, 필요하면 basePort를 조정합니다.
  • Synonym Not Applied – 용어를 추가한 후 indexer.setDictionary(dictionary)를 호출했는지 확인하십시오. 그렇지 않으면 새 동의어가 검색에 적용되지 않습니다.
  • Node Not Responding – 이벤트를 구독하고 NodeFailed 콜백을 확인하여 네트워크 문제를 진단합니다.
  • Memory Leak on Close – 배포된 모든 노드에 대해 항상 node.close()를 호출하고, 자동 정리를 위해 try‑with‑resources 블록 사용을 고려하십시오.

자주 묻는 질문

Q: How does deploying multiple nodes improve search performance?
A: 각 노드가 데이터의 샤드를 인덱싱하여 병렬 처리를 가능하게 하고, 워크로드가 클러스터에 분산되면서 쿼리 지연 시간이 감소합니다.

Q: Can I add synonyms without re‑indexing existing documents?
A: 예, 런타임에 동의어 사전을 통해 add synonyms to index 할 수 있으며, 변경 사항은 새로운 쿼리에 즉시 적용됩니다.

Q: Is subscribing to node events mandatory?
A: 기본 동작에 필수는 아니지만, 이벤트 구독을 통해 노드 상태를 파악하고 장애에 신속히 대응할 수 있습니다.

Q: What are best practices for managing node resources?
A: 유휴 노드를 정기적으로 종료하고, JVM 메모리 사용량을 모니터링하며, 비피크 시간에 노드를 재활용해 리소스 소비를 최적화합니다.

Q: Does GroupDocs.Search support non‑text formats like PDFs or images?
A: 물론입니다. 라이브러리는 PDF, Office 파일에서 텍스트를 추출하고 이미지에 대해 OCR을 수행하여 즉시 검색 가능하게 합니다.

Last Updated: 2026-07-16
Tested With: GroupDocs.Search 25.4 for Java
Author: GroupDocs

관련 튜토리얼