문서 검색을 위한 GroupDocs.Search Java 구현

오늘날 데이터‑드리븐 환경에서 implement groupdocs search java는 PDF, Word 파일, 스프레드시트 등에서 빠르고 신뢰할 수 있는 전체 텍스트 검색이 필요한 모든 애플리케이션에 필수적입니다. 법률 계약 저장소, 학술 연구 포털, 고객 지원 지식 베이스를 구축하든, 이 튜토리얼은 SDK 설치, 인덱스 생성, 퍼지 쿼리 실행, 하이라이트된 검색어가 포함된 HTML 생성까지 Java로 안내합니다.

빠른 답변

  • 어떤 라이브러리가 implement groupdocs search java를 도와줍니까? GroupDocs.Search for Java.
  • 결과에서 search terms java를 강조 표시할 수 있나요? 예—generated HTML can automatically wrap matches with <mark> tags.
  • 프로덕션에 라이선스가 필요합니까? 무료 체험판을 사용할 수 있으며, 상업적 사용을 위해서는 정식 라이선스가 필요합니다.
  • 어떤 IDE가 가장 적합합니까? Any Java IDE—IntelliJ IDEA, Eclipse, or VS Code.
  • Maven을 지원합니까? 물론—add the repository and dependency to your pom.xml.

GroupDocs.Search for Java란?

GroupDocs.Search는 전체 파일을 메모리에 로드하지 않고도 PDF, DOCX, XLSX, PPTX, TXT 등 50개 이상의 문서 형식을 인덱싱하고 텍스트를 검색하는 Java SDK입니다. 퍼지 매칭, Boolean 연산자, 구문 쿼리 및 내장된 결과 하이라이팅을 제공하여 검색 가능한 문서 저장소를 위한 즉시 사용 가능한 솔루션입니다.

GroupDocs.Search와 함께 Search Documents Java를 사용하는 이유

인덱싱된 검색은 10 k 문서에 대해 10 ms 미만의 결과를 반환하여 속도를 제공하고, 퍼지 검색, Boolean 논리, 구문 쿼리 및 동의어 확장을 통해 유연성을 제공하며, 일치 항목을 자동으로 표시하는 HTML 미리보기를 생성하여 하이라이팅을 수행하고, 온프레미스, 클라우드 또는 하이브리드 환경에서 작동하면서 수백 페이지 파일도 과도한 메모리 사용 없이 처리할 수 있어 확장성을 제공합니다.

사전 요구 사항

  • Java Development Kit (JDK) 8 이상.
  • Maven(또는 수동 JAR 관리).
  • IntelliJ IDEA, Eclipse 또는 VS Code와 같은 IDE.
  • Java 프로젝트 구조와 Maven에 대한 기본적인 이해.

GroupDocs.Search for Java 설정

Maven을 통한 설치

Add the GroupDocs repository and the Search 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>

직접 다운로드

Maven을 사용하고 싶지 않은 경우, 공식 릴리스 페이지에서 최신 JAR를 다운로드하십시오: GroupDocs.Search for Java releases.

라이선스 획득 단계

  • 무료 체험: 기능을 탐색하기 위해 무료 체험으로 시작하십시오.
  • 임시 라이선스: GroupDocs’ official site에서 획득하십시오.
  • 구매: 무제한 프로덕션 사용을 위한 정식 라이선스를 구매하십시오.

기본 초기화 및 설정

The Index class is the core component that represents a searchable index stored on disk. After creating an index folder, you instantiate the Index object to add, delete, or query documents:

String indexFolder = "YOUR_DOCUMENT_DIRECTORY/ObtainSearchResultInformation";
Index index = new Index(indexFolder);

문서 검색 Java 방법 – 기능 1: 검색 결과 정보 추출

이 기능은 쿼리를 실행하고, 일치하는 문서를 검색하며, 각 용어에 대한 상세 발생 데이터를 얻는 방법을 설명합니다. 단계에 따라 진행하면 검색 결과를 기반으로 분석 대시보드나 상세 보고서를 생성할 수 있습니다.

단계 1: 인덱스 생성

The Index class is the top‑level object that stores searchable metadata on disk. Creating it points to a folder where all index files will reside:

String indexFolder = YOUR_DOCUMENT_DIRECTORY + "/ObtainSearchResultInformation";
Index index = new Index(indexFolder);
index.add(documentFolder);

단계 2: 검색 옵션 구성 (퍼지 검색 활성화)

SearchOptions lets you fine‑tune query behavior. Setting FuzzySearch to true enables approximate matching, which is useful for handling typos or OCR errors:

SearchOptions options = new SearchOptions();
options.getFuzzySearch().setEnabled(true);
options.getFuzzySearch().setFuzzyAlgorithm(new TableDiscreteFunction(3));

단계 3: 검색 실행

Index.search runs the query against the prepared index and returns a SearchResult collection containing matched documents and term occurrences:

String query = "favourable OR \"ipsum dolor\"";
SearchResult result = index.search(query, options);

SearchResult 객체는 쿼리와 일치하는 문서 목록과 해당 관련 점수를 포함합니다.

단계 4: 발생 추출

Each SearchResult item provides getOccurrences() which returns the exact positions of the query terms inside the source file, allowing you to build analytics dashboards or detailed reports:

for (int i = 0; i < result.getDocumentCount(); i++) {
    FoundDocument document = result.getFoundDocument(i);
    for (FoundDocumentField field : document.getFoundFields()) {
        if (field.getTerms() != null) {
            for (String term : field.getTerms()) {
                int occurrences = field.getTermsOccurrences()[field.getTerms().indexOf(term)];
                System.out.println("Term: " + term + ", Occurrences: " + occurrences);
            }
        }
        if (field.getTermSequences() != null) {
            for (String[] terms : field.getTermSequences()) {
                int occurrences = field.getTermSequencesOccurrences()[ArrayUtils.indexOf(field.getTermSequences(), terms)];
                StringBuilder sequence = new StringBuilder();
                for (String term : terms) {
                    sequence.append(term).append(" ");
                }
                System.out.println("Phrase: " + sequence.toString() + ", Occurrences: " + occurrences);
            }
        }
    }
}

기능 2: 문서에서 Java 검색어 강조 표시

각 일치 항목이 <mark> 태그로 감싸진 HTML 미리보기를 생성하여 최종 사용자에게 즉시 시각적 힌트를 제공합니다.

단계 1: 고압축 인덱스 설정

High compression reduces storage by up to 70 % while keeping query speed within milliseconds. Adjust the CompressionLevel property before indexing:

String indexFolder = YOUR_DOCUMENT_DIRECTORY + "/HighlightSearchResults";
IndexSettings settings = new IndexSettings();
settings.setTextStorageSettings(new TextStorageSettings(Compression.High));
Index index = new Index(indexFolder, settings);
index.add(documentFolder);

단계 2: 검색 수행 및 결과 강조 표시

After executing the search, call highlight() on the SearchResult object to produce an HTML file that highlights every occurrence of the query term. The highlight() method generates an HTML preview with matched terms wrapped in <mark> tags:

SearchResult result = index.search("solicitude");
if (result.getDocumentCount() > 0) {
    FoundDocument document = result.getFoundDocument(0);
    String path = YOUR_OUTPUT_DIRECTORY + "/Highlighted.html";
    OutputAdapter outputAdapter = new FileOutputAdapter(OutputFormat.Html, path);
    Highlighter highlighter = new DocumentHighlighter(outputAdapter);
    index.highlight(document, highlighter);
}

실용적인 적용 사례

  1. 법률 문서 검토 – 수천 개의 계약서에서 특정 조항을 몇 초 만에 찾습니다.
  2. 학술 연구 – 연구 논문에서 핵심 구문을 추출하여 문헌 검토에 활용합니다.
  3. 고객 지원 – 이메일 아카이브에서 반복되는 문제를 식별하여 FAQ 페이지를 개선합니다.
  4. 콘텐츠 관리 – 기사와 블로그에서 SEO 키워드를 강조 표시하여 빠른 편집 검사를 수행합니다.

성능 고려 사항

  • 압축: 고압축은 저장소를 줄이지만 CPU 사용량이 증가할 수 있습니다; 일반 작업량으로 벤치마크하십시오.
  • 메모리 관리: JVM 힙을 제어하기 위해 문서를 500 – 1 000 파일 배치로 인덱싱하십시오.
  • 인덱스 새로 고침: 검색 결과가 최신 상태를 유지하도록 변경된 파일을 매일 밤 재인덱싱하십시오.

결론

이 가이드는 implement groupdocs search java를 수행하고, 상세 결과 정보를 추출하며, HTML 미리보기에 highlight search terms java를 강조 표시하는 방법을 보여줍니다. 이러한 단계를 따르면 모든 문서 저장소에 빠르고 사용자 친화적인 검색 경험을 제공할 수 있습니다.

다음 단계

  • <iframe> 또는 서버‑사이드 렌더링을 사용하여 강조된 HTML을 웹 UI에 삽입합니다.
  • SynonymSearch 또는 WildcardSearch와 같은 추가 SearchOptions를 실험해 보세요.
  • 맞춤 점수 부여, 결과 페이지 처리 및 다국어 지원을 위해 GroupDocs.Search API 레퍼런스를 살펴보세요.

자주 묻는 질문

Q: GroupDocs.Search란?
A: GroupDocs.Search는 50개 이상의 문서 형식을 인덱싱하고 텍스트를 검색하는 Java SDK이며, 퍼지 매칭 및 결과 하이라이팅을 제공합니다.

Q: 퍼지 검색은 어떻게 작동합니까?
A: 설정 가능한 문자 차이 수를 허용하여 오타나 OCR 오류가 있는 단어에도 매치를 가능하게 합니다.

Q: 라이선스 없이 GroupDocs.Search를 사용할 수 있나요?
A: 예, 무료 체험판을 사용할 수 있지만, 프로덕션 배포에는 정식 라이선스가 필요합니다.

Q: 지원되는 파일 형식은 무엇입니까?
A: PDF, DOCX, XLSX, PPTX, TXT 등 다수—전체 목록은 공식 문서를 참조하십시오.

Q: 웹 애플리케이션에서 강조된 결과를 어떻게 표시합니까?
A: 생성된 HTML 파일을 직접 제공하거나 <iframe> 또는 서버‑사이드 렌더링을 사용해 페이지에 삽입합니다.


마지막 업데이트: 2026-07-26
테스트 환경: GroupDocs.Search 25.4
작성자: GroupDocs

관련 튜토리얼