نحن سعداء بالإعلان عن إصدار GroupDocs.Search for Python v26.10، المتاح اعتبارًا من نوفمبر 2026. هذا هو الإصدار الأول للمنتج، حيث يجلب كامل وظائف محرك GroupDocs.Search 26.10 إلى مطوري Python. يتيح بناء وصيانة فهارس نصية كاملة على مجلدات المستندات — بما في ذلك PDF وWord وExcel وPowerPoint والبريد الإلكتروني والكتاب الإلكتروني والأرشيف والعديد من الصيغ الأخرى (أكثر من 80 صفة) — والبحث فيها باستخدام أنواع استعلام متقدمة: كلمات مفتاحية، عبارات، أحرف بدل، تعبيرات regex، بحث ضبابي، منطقي، موجه، وبحث بنطاقات التاريخ. يدعم الإصدار Python 3.5–3.14 على Windows x64، Linux x64 (glibc 2.27+)، وmacOS 13+ (Intel وApple Silicon)، مع تضمين بيئة تشغيل .NET 10.0.14.

ما الجديد في هذا الإصدار

  • [Feature] الإصدار الأولي لـ GroupDocs.Search for Python عبر .NET (SEARCHPYTHONNET-40)

تغييرات واجهة برمجة التطبيقات العامة

هذا هو الإصدار الأول، لذا لا يوجد ما يحتاج إلى ترقية. تتبع الواجهة API نسخة GroupDocs.Search for .NET 26.10: تحتفظ الفئات بأسمائها في .NET، بينما تُكتب الأساليب والخصائص والمعلمات بصيغة snake_case (Index.Search يصبح index.search، SearchResult.DocumentCount يصبح result.document_count) وأعضاء التعداد بأحرف كبيرة (OutputFormat.HTML). يؤدي تعيين سمة لا تمتلكها الفئة إلى رفع AttributeError مع تلميح “هل تقصد”، بدلاً من إنشاء سمة خاصة بـ Python لا يرى المحركها أبدًا.

الوحدات

  • 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) من واحد إلى خمسة)، تعبيرات عادية بعد ^، 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

التحميل المباشر

قم بتنزيل الحزمة wheel لمنصتك من صفحة 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

الموارد