우리는 GroupDocs.Search for Python v26.10의 출시를 기쁘게 발표합니다. 이 버전은 2026년 11월부터 사용할 수 있습니다. 이는 제품의 초기 릴리스로, GroupDocs.Search 26.10 엔진의 전체 기능을 Python 개발자에게 제공합니다. PDF, Word, Excel, PowerPoint, 이메일, eBook, 아카이브 및 기타 많은 형식(총 80개 이상)을 포함한 문서 폴더에 대한 전체 텍스트 인덱스를 구축하고 유지하며, 키워드, 구문, 와일드카드, 정규식, 퍼지, 불리언, 계층형, 날짜 범위 검색과 같은 고급 쿼리 유형으로 검색할 수 있습니다. 이 릴리스는 Windows x64, Linux x64 (glibc 2.27+), macOS 13+ (Intel 및 Apple Silicon)에서 Python 3.5–3.14를 지원하며, .NET 10.0.14 런타임을 포함합니다.

이번 릴리스의 새로운 기능

  • [Feature] GroupDocs.Search for Python via .NET 초기 릴리스 (SEARCHPYTHONNET-40)

공개 API 변경 사항

이것은 첫 번째 릴리스이므로 업그레이드할 항목이 없습니다. API는 GroupDocs.Search for .NET 26.10을 따릅니다: 클래스는 .NET 이름을 유지하고, 메서드, 속성 및 매개변수는 snake_case(Index.Search는 index.search, SearchResult.DocumentCount는 result.document_count)로, 열거형 멤버는 대문자(OutputFormat.HTML)로 작성됩니다. 클래스에 존재하지 않는 속성을 할당하면 엔진이 전혀 보지 못하는 Python 전용 속성을 만들지 않고, “Did you mean” 힌트와 함께 AttributeError가 발생합니다.

모듈

  • groupdocs.search: Index, IndexSettings, IndexRepository, IndexUpdater, SearchQuery, Extractor, License, Metered, GroupDocsSearchException, LicenseError, CancellationTokenSource.
  • groupdocs.search.options: IndexingOptions, SearchOptions, FuzzySearchOptions, SimilarityLevel, UpdateOptions, HighlightOptions, OutputFormat, SeparateProcessOptions, ImageSearchOptions.
  • groupdocs.search.results: SearchResult, FoundDocument, FoundDocumentField, DocumentInfo, FileType, FormatFamily.
  • groupdocs.search.highlighters: DocumentHighlighter, FragmentHighlighter.
  • groupdocs.search.common: FileOutputAdapter, StringOutputAdapter, StreamOutputAdapter, Document, DocumentField, ExtractedData, FileLogger, AttributeChangeBatch.
  • groupdocs.search.dictionaries: SynonymDictionary, HomophoneDictionary, StopWordDictionary, SpellingCorrector, AliasDictionary, CharacterReplacementPair.
  • groupdocs.search.events: EventHub, FileIndexingEventArgs, IndexErrorEventArgs, OperationProgressEventArgs, PasswordRequiredEventArgs.
  • groupdocs.search.exceptions: SearchException, LicenseRestrictionException.
  • groupdocs.search.scaling: SearchNetworkNode, Indexer, Searcher.
  • groupdocs.search.scaling.configuring: Configuration, Configurator, TcpSettings.

새로운 기능

문서를 인덱싱하고 검색하기

Index(folder)는 폴더에 인덱스를 생성하거나 이미 존재하는 인덱스를 엽니다. add()는 폴더, 파일, 경로 목록, 스트림 또는 추출된 데이터를 인덱싱하고, search()는 GroupDocs.Search 쿼리 언어를 사용한 쿼리를 받습니다: 키워드, 따옴표 안의 구문, 와일드카드(?는 한 문자, ?(1~5)는 1~5 문자), ^ 뒤의 정규식, AND, OR, NOT, content: Bern 또는 filename: einstein 같은 필드 쿼리, 그리고 날짜 및 숫자 범위. SearchQuery는 동일한 쿼리를 객체 형태로 구축합니다.

from groupdocs.search import Index

with Index("./index") as index:              # creates the index folder, or opens it
    index.add("./documents")                 # indexes every supported file in the folder
    for query in ["relativity", '"theory of relativity"', "relativ?ty",
                  "^relativ.*", "Einstein AND NOT Newton", "content: Bern"]:
        result = index.search(query)
        print("%-26s %d documents, %d occurrences"
              % (query, result.document_count, result.occurrence_count))

퍼지, 동의어 및 단어 형태 검색

퍼지 검색은 타이핑 및 OCR 오류를 허용합니다. 동의어, 동음이의어 및 단어 형태 검색은 내장된 영어 사전을 통해 쿼리를 확장하며, index.dictionaries를 통해 편집할 수 있고, 맞춤법 및 키보드 레이아웃 교정도 검색 옵션에 포함됩니다.

from groupdocs.search import Index
from groupdocs.search.options import SearchOptions, SimilarityLevel

with Index("./index") as index:
    index.add("./documents")

    fuzzy = SearchOptions()
    fuzzy.fuzzy_search.enabled = True
    fuzzy.fuzzy_search.fuzzy_algorithm = SimilarityLevel(0.8)   # 0.0 (loose) .. 1.0 (strict)
    print("relativty:", index.search("relativty").document_count,
          "->", index.search("relativty", fuzzy).document_count)

    synonyms = SearchOptions()
    synonyms.use_synonym_search = True
    print("picture:", index.search("picture").document_count,
          "->", index.search("picture", synonyms).document_count)

    word_forms = SearchOptions()
    word_forms.use_word_forms_search = True
    print("letter:", index.search("letter").document_count,
          "->", index.search("letter", word_forms).document_count)

찾은 내용을 강조 표시

DocumentHighlighter는 찾은 용어가 표시된 전체 문서를 작성하고, FragmentHighlighter는 해당 용어 주변의 조각만을 HTML 또는 일반 텍스트 형태로 파일, 문자열 또는 바이너리 파일 객체에 기록합니다.

from groupdocs.search import Index
from groupdocs.search.common import FileOutputAdapter
from groupdocs.search.highlighters import DocumentHighlighter
from groupdocs.search.options import OutputFormat

with Index("./index") as index:
    index.add("./documents")
    result = index.search("relativity")
    if result.document_count > 0:
        found = result.get_found_document(0)
        adapter = FileOutputAdapter(OutputFormat.HTML, "./highlighted.html")
        index.highlight(found, DocumentHighlighter(adapter))
        print(found.document_info.file_path, "-> highlighted.html")

.NET 이벤트를 Python 핸들러로 사용

인덱스의 모든 이벤트는 Python 이벤트이며 += 로 구독하고 -= 로 구독 해제합니다. 핸들러는 문서를 건너뛰거나 속성을 태그하거나 비밀번호를 제공할 수 있으며, 인덱싱 및 검색 과정의 진행 상황, 오류 및 단계들을 따라갑니다.

from groupdocs.search import Index

skipped = []

def on_file_indexing(sender, args):
    if args.document_full_path.endswith(".zip"):
        args.skip_indexing = True            # leave archives out of the index
        skipped.append(args.document_full_path)

with Index("./index") as index:
    index.events.file_indexing += on_file_indexing
    index.add("./documents")
    index.events.file_indexing -= on_file_indexing
    print(len(index.get_indexed_documents()), "documents indexed,", len(skipped), "archives skipped")

엔진 확장 지점을 위한 Python 객체

사용자 정의 텍스트 추출기, 로거, 단어 분리기, 형태소 제공자, 문서 로더 및 OCR 커넥터는 순수 Python 객체 또는 함수이며, 엔진은 인터페이스를 통해 이를 호출합니다.

from groupdocs.search import Index, IndexSettings

class LogExtractor(object):
    """Text of .log files, which the engine does not read on its own."""
    extensions = [".log"]

    def get_fields(self, source):             # a file path, or the engine's stream
        if isinstance(source, str):
            with open(source, encoding="utf-8") as f:
                text = f.read()
        else:
            text = source.read().decode("utf-8")
        return [("Content", text)]

settings = IndexSettings()
settings.custom_extractors.add(LogExtractor())
with Index("./log-index", settings) as index:
    index.add("./logs")
    print(index.search("quota").document_count, "log file(s) mention a quota")

인덱스를 최신 상태로 유지하기

인덱스는 폴더입니다: 한 번 구축하고 이후 실행에서 다시 엽니다. update()는 마지막 add() 또는 update() 이후 변경된 문서만 재인덱싱하고, optimize()는 인덱스 세그먼트를 병합하며, delete()는 경로별로 문서를 제거합니다.

from groupdocs.search import Index

with Index("./index") as index:
    index.add("./documents")
    # ... files in ./documents are added, changed or removed ...
    index.update()        # re-indexes only what changed
    index.optimize()      # merges index segments so searches stay fast
    print(len(index.get_indexed_documents()), "documents in the index")

환경에서 라이선스 가져오기

GROUPDOCS_LIC_PATH를 라이선스 파일의 경로나 URL로 설정하면 엔진에 최초 호출될 때 라이선스가 적용됩니다; 코드에서는 License().set_license(path)가 동일한 역할을 합니다. 적용할 수 없는 라이선스는 첫 호출부터 LicenseError를 발생시키며 평가 모드로 전환되지 않습니다. 라이선스가 없으면 인덱스는 최대 100개의 문서만 포함하고, 검색 시 찾은 문서 중 처음 10개만 읽을 수 있습니다.

export GROUPDOCS_LIC_PATH="/path/to/GroupDocs.Search.lic"

코드 예제

위의 “문서를 인덱싱하고 검색하기”, “퍼지, 동의어 및 단어 형태 검색”, “찾은 내용을 강조 표시”, “.NET 이벤트를 Python 핸들러로 사용”, “엔진 확장 지점을 위한 Python 객체”, “인덱스를 최신 상태로 유지하기” 섹션을 참고하면 작동하는 코드 예제를 확인할 수 있습니다.

업데이트 받는 방법

PyPI

직접 다운로드

GroupDocs.Search for Python via .NET 26.10 페이지에서 플랫폼에 맞는 휠 파일을 다운로드한 뒤 파일을 설치합니다:

  • Windows x64: pip install groupdocs_search_net-26.10.0-py3-none-win_amd64.whl
  • Linux x64: pip install groupdocs_search_net-26.10.0-py3-none-manylinux_2_27_x86_64.whl
  • macOS Intel: pip install groupdocs_search_net-26.10.0-py3-none-macosx_13_0_x86_64.whl
  • macOS Apple Silicon: pip install groupdocs_search_net-26.10.0-py3-none-macosx_13_0_arm64.whl

리소스