GroupDocs.Search for .NET 26.11 现已发布。此版本使重复和同步搜索速度更快,将索引分配的内存降低至最多 4.5 倍,并通过节点身份验证保护搜索网络。搜索网络中的索引速度提升5 到 20 倍,且 GroupDocs.Search NuGet 包现在包含针对 .NET Framework 4.8、.NET 6.0、.NET 8.0 和 .NET 10.0 的构建。
由 26.10 版本创建的索引可无需转换打开。此版本包含18 项更改:5 项新功能,12 项改进和 1 项修复。
性能亮点
完整的发行说明描述了每个图表的测试设置。
| 项目 | 26.11 中的提升 |
|---|---|
| 重复正则表达式搜索 | 提升至最高 300 倍 |
| 重复模糊搜索 | 提升 4 到 30 倍 |
| 索引的同步搜索 | 8 次同步搜索的中位时间 从 5.6 ms 降至 0.18 ms;每秒搜索次数提升 4% 到 18% |
| 允许一次错误的模糊搜索 | 提升 1.8 倍,使用 8 个搜索线程时提升 4.5 倍 |
| 日期范围搜索 | 提升最高 10 倍,按块时提升 最高 59 倍;长范围返回 完整结果 |
| 索引分配的内存 | 降低至最高 4.5 倍 |
| 使用存储文档文本的索引 | 提升最高 2.2 倍 |
| 检索存储的文档文本 | 提升 3.5 倍,内存降低 11 倍 |
| 合并索引 | 提升 3.5 倍,内存降低 接近 50 倍 |
| 搜索网络中的索引 | 提升 5 到 20 倍,分片中的索引段显著减少 |
| 在主节点注册 20,000 个文档 | 从 27.1 秒降至 0.12 秒,写入磁盘 0.8 MB 而非 7.6 GB |
| 索引的磁盘空间 | 可在加载速度的代价下减少 |
本次发行的新功能
| 键 | 摘要 | 类别 |
|---|---|---|
| SEARCHNET-3729 | 实现一个选项,以在加载速度的代价下减少索引占用的磁盘空间 | 功能 |
| SEARCHNET-3730 | 实现搜索网络节点的身份验证 | 功能 |
| SEARCHNET-3731 | 实现对文档提取的 OCR 支持(在单独进程中) | 功能 |
| SEARCHNET-3732 | 实现索引仓库的块搜索 | 功能 |
| SEARCHNET-3733 | 实现对自定义分词器生成的词进行高亮显示 | 功能 |
| SEARCHNET-3734 | 优化块搜索 | 改进 |
| SEARCHNET-3735 | 实现索引并发搜索的共享线程池 | 改进 |
| SEARCHNET-3736 | 实现重复搜索中匹配词的复用 | 改进 |
| SEARCHNET-3737 | 在 Cancellation 类中实现 IDisposable 接口 | 改进 |
| SEARCHNET-3738 | 使用额外的文字扩展默认字母表 | 改进 |
| SEARCHNET-3739 | 加速日期范围搜索并确保长日期范围的完整结果 | 改进 |
| SEARCHNET-3740 | 降低索引以及使用存储文档文本的操作的内存消耗 | 改进 |
| SEARCHNET-3741 | 加速在文档数量庞大的搜索网络中的索引 | 改进 |
| SEARCHNET-3742 | 实现搜索网络中批量索引和分片请求的并行处理 | 改进 |
| SEARCHNET-3743 | 在 Index、IndexRepository、Cancellation、ExtractionHost 和 SearchNetworkNode 类中实现释放模式 | 改进 |
| SEARCHNET-3693 | 为 GroupDocs.Search NuGet 包实现 TFM-Split 打包策略 | 改进 |
| SEARCHNET-3747 | 为 .NET Framework 4.8、.NET 6.0、.NET 8.0、.NET 10.0 实现 NuGet 包 | 改进 |
| SEARCHNET-3746 | 修复搜索网络对丢失或无响应节点的无限等待 | 修复 |
主要功能
搜索
- 重复的通配符、正则表达式、数值范围和模糊搜索会复用先前使用相同查询找到的词,直至索引发生变化。保留的词每个索引最多占用 8 MB 内存。
- 索引的同步搜索共享其搜索线程(
IndexSettings.SearchThreads),因此短搜索不再等待长搜索。 - 日期范围搜索仅从索引读取每一天、每个月和每一年一次,而不是对范围内的每个日期分别搜索。长范围不再因出现次数限制而被截断,之前失败的全部可能日期范围现在可在数秒内完成搜索。
- 块搜索获得了上述所有提升,且索引仓库现在也可以按块搜索:
IndexRepository.SearchNext按索引逐个继续搜索。 - 高亮显示和
Index.GetDocumentText可以使用用于索引的自定义分词器对文本进行分割,从而分词器生成的词(例如没有空格的文本词)也会被高亮。 - 新索引的默认字母表包括希伯来文、天城文、格鲁吉亚文、扩展拉丁文、希腊文和韩文字符以及组合变音符号。诸如 “Việt” 的词不再被拆分,韩文和希伯来文词也会完整索引和匹配。
索引与索引存储
- 新的
IndexSettings.UseFastLoading设置允许磁盘上的索引去除额外数据,从而使加载速度提升数倍:索引占用更少磁盘空间,但加载时间更长。此设置可随时更改,即使是已包含文档的索引也可修改。 - 索引每个文档分配的内存最多降低 4.5 倍,且在存储文档文本时运行速度提升至最高 2.2 倍。检索存储文本的速度提升 3.5 倍,内存降低 11 倍;合并索引的速度提升 3.5 倍,内存降低接近 50 倍。
- 现在可以识别在单独进程中提取的文档图像文本:
ExtractionHost.OcrConnector设置提取进程的 OCR 连接器。如果启用了识别但提取进程没有 OCR 连接器,索引会通过ErrorOccurred事件报告。
搜索网络
- 节点使用共享密钥(
TcpSettings.NetworkKey)相互认证,并对每条消息进行签名:没有密钥的计算机既无法向节点发送指令,也无法响应。密钥永不在网络上传输。从节点还可以限制接受主节点的地址(TcpSettings.AllowedMasterAddresses)。 - 索引速度提升 5 到 20 倍,且创建的索引段显著更少:当分片忙碌时到达的文档会以最多 1,000 个文档或 16 MB 为批次进行索引,节点的分片并行处理请求。
- 在主节点注册已索引文档时不再随数量增长而变慢,并且在写入失败或进程崩溃时,分片的文档列表能够安全保留。
- 主节点能够检测丢失和无响应的节点:从节点每 5 秒报告一次,调用不再无限期等待已消失的节点。
TcpSettings.ResponseTimeout也可限制主节点等待响应的时长。
API 与打包
Index、IndexRepository、Cancellation、ExtractionHost和SearchNetworkNode实现了标准的 .NET 释放模式,派生类可释放自身资源。释放Cancellation会取消CancelAfter调度的计时器。- GroupDocs.Search NuGet 包现在除了 .NET Framework 4.6.2 和 .NET Standard 2.1 外,还包含针对 .NET Framework 4.8、.NET 6.0、.NET 8.0 和 .NET 10.0 的构建,并会自动为项目的目标框架选择相应构建。
公共 API 更改
以下成员已添加:
-
GroupDocs.Search.IndexSettings:Boolean UseFastLoading– 保持使磁盘上的索引加载速度提升数倍的额外数据。默认启用;将其设为false可节省磁盘空间。
-
GroupDocs.Search.Scaling.Configuring.TcpSettings:String NetworkKey– 搜索网络的密钥,长度至少 16 个字符,所有节点保持一致。String[] AllowedMasterAddresses– 从属节点接受主节点连接的 IPv4 地址或主机名。Int32 ResponseTimeout– 主节点等待节点对请求响应的时间(毫秒),默认无限制。
-
GroupDocs.Search.ExtractionHost:IOcrConnector OcrConnector– 单独提取进程的 OCR 连接器。
-
GroupDocs.Search.IndexRepository:SearchResult SearchNext(ChunkSearchToken)和SearchResult SearchNext(ChunkSearchToken, Cancellation)– 在索引仓库中继续块搜索。
-
GroupDocs.Search.Options.TextOptions:IWordSplitter WordSplitter– 高亮显示和Index.GetDocumentText使用的分词器;由HighlightOptions继承。
-
GroupDocs.Search.Common.Cancellation现在实现IDisposable:void Dispose()– 释放已调度取消的计时器;调度的取消不会被请求。
-
Index、IndexRepository、Cancellation、ExtractionHost和SearchNetworkNode:protected virtual void Dispose(Boolean disposing)– 派生类的释放模式方法。
以下升级说明列出了可能需要修改代码的行为更改。
代码示例
按块搜索索引仓库
以下示例按块逐个搜索仓库中的两个索引,依次进行。
string indexFolder1 = @"c:\MyIndex1\"; // Specify the path to the first index folder
string indexFolder2 = @"c:\MyIndex2\"; // Specify the path to the second index folder
string documentsFolder1 = @"c:\MyDocuments1\"; // Specify the path to a folder containing documents to index
string documentsFolder2 = @"c:\MyDocuments2\"; // Specify the path to another folder containing documents to index
using (IndexRepository repository = new IndexRepository()) // Creating an index repository
{
Index index1 = repository.Create(indexFolder1); // Creating the first index in the repository
index1.Add(documentsFolder1); // Indexing documents from the first folder
Index index2 = repository.Create(indexFolder2); // Creating the second index in the repository
index2.Add(documentsFolder2); // Indexing documents from the second folder
SearchOptions options = new SearchOptions();
options.IsChunkSearch = true; // Enabling search by chunks
SearchResult result = repository.Search("Einstein", options); // Getting the first chunk of the first index
Console.WriteLine("Documents: " + result.DocumentCount);
while (result.NextChunkSearchToken != null)
{
result = repository.SearchNext(result.NextChunkSearchToken); // Getting the next chunk, index by index
Console.WriteLine("Documents: " + result.DocumentCount);
}
}
使用共享密钥保护搜索网络
搜索网络的每个节点都使用相同的密钥。从节点仅接受来自其地址的主节点,并且主节点限制对节点响应的等待时间。
string basePath = @"c:\SearchNetwork\"; // Specify the path to the folder of the search network
string networkKey = Environment.GetEnvironmentVariable("SEARCH_NETWORK_KEY"); // The same key of at least 16 characters on every node
// On the server of slave node 1: the connection of the master node is accepted from 10.0.0.5 only
TcpSettings slaveSettings = new TcpSettings(49101, 10000, 10000, 10000, 1000);
slaveSettings.NetworkKey = networkKey;
slaveSettings.AllowedMasterAddresses = new string[] { "10.0.0.5" };
SearchNetworkNode node1 = SearchNetworkNode.CreateSlaveNode(1, basePath + "Node1", slaveSettings);
node1.Start();
// On the server of the master node (10.0.0.5): the responses of the nodes are awaited no longer than 10 minutes
Configuration configuration = Configuration.Load(basePath + "Configuration.xml"); // Loading the search network configuration
TcpSettings masterSettings = new TcpSettings(49100, 10000, 10000, 10000, 1000);
masterSettings.NetworkKey = networkKey;
masterSettings.ResponseTimeout = 600000;
SearchNetworkNode node0 = SearchNetworkNode.CreateMasterNode(
0, basePath + "Node0", masterSettings, new FileLogger(basePath + "Log.txt", 4.0), configuration);
node0.ConfigureAllNodes();
node0.Start();
减少索引的磁盘空间
以下示例创建一个占用更少磁盘空间的索引,然后再次使其快速加载。
string indexFolder = @"c:\MyIndex\"; // Specify the path to the index folder
string documentsFolder = @"c:\MyDocuments\"; // Specify the path to a folder containing documents to index
IndexSettings settings = new IndexSettings();
settings.UseFastLoading = false; // The index takes less disk space but loads longer
using (Index index = new Index(indexFolder, settings, true)) // Creating an index with the settings
{
index.Add(documentsFolder); // Indexing documents from the specified folder
}
using (Index index = new Index(indexFolder)) // Opening the existing index
{
index.IndexSettings.UseFastLoading = true; // The data is created the next time the index is loaded
}
升级说明
升级自先前版本时请考虑以下更改:
- 由 26.11 版本更改的索引无法被早期版本打开。 26.11 版本可以在无需转换的情况下打开 26.10 版本的索引,但一旦创建或更改索引(通过索引、删除文档、优化或更改设置),早期版本将无法再打开。请同时升级所有共享同一索引文件夹的应用程序,包括搜索网络的节点。
- .NET Framework 项目使用 GroupDocs.Search 包。 将
GroupDocs.Search.NETFramework替换为GroupDocs.Search,后者现在包含 .NET Framework 4.6.2 和 4.8 的构建,并会自动选择合适的构建。GroupDocs.Search.NETFramework没有 26.11 版本。 - 搜索网络的所有节点必须一起升级。 26.10 与 26.11 版本的节点无法相连。为保护网络,请在每个节点上设置相同的
TcpSettings.NetworkKey:密钥不同的节点,或有密钥而另一个没有密钥的节点,均无法连接,并且都会在日志中写入原因。没有密钥的节点仍按以前方式工作,并在日志中写入警告。 - 搜索网络的消息已签名但未加密。 请将节点置于受信任网络中,或通过加密隧道连接。
- 检测到丢失的节点。 例如在调试器中暂停的进程,如果 15 秒未发送任何信息,则被视为丢失:等待该节点的调用会抛出
SearchException,其文档会发送给其他节点或通过ErrorOccurred事件报告。默认情况下,主节点无限期等待响应;可通过设置TcpSettings.ResponseTimeout来限制等待时间。 IndexSettings.SearchThreads被索引的所有搜索共享。 单个搜索仍使用原有线程数,但 K 个同步搜索现在在 max(K,SearchThreads) 线程上运行,而不是 K ×SearchThreads。- 仅新索引拥有扩展字母表。 早期版本的索引(包括通过
IndexUpdater更新的)仍会像以前一样拆分这些文字的词,且Index.Merge拒绝合并新旧索引。若要合并,请使用ExportDictionary导出旧索引的Alphabet和TokenizationDictionary,在添加文档前使用Clear和ImportDictionary将其导入新索引。 - 出现次数限制仅计数日期的各部分一次。
SearchOptions.MaxTotalOccurrenceCount和MaxOccurrenceCountPerTerm对每一天、每个月或每一年在一次搜索(或一次块)中计数一次,而不是对范围内的每个日期计数。之前因达到限制而未搜索完整的日期范围现在可能会找到所有日期。 - 索引仓库的块搜索按索引逐个进行。 使用
IsChunkSearch的IndexRepository.Search返回第一个索引的第一块。随后在SearchResult.NextChunkSearchToken不为 null 时使用IndexRepository.SearchNext继续,或在不使用块的情况下搜索以一次性获取所有文档。 - 单独提取进程中的 OCR 使用 ExtractionHost.OcrConnector。 在提取进程的程序中设置连接器,并使用与应用程序相同的 GroupDocs.Search 版本构建该程序。索引选项中的 OCR 连接器在此不被使用。
- 网络索引进度按分片响应报告。
NodeEventHub.IndexingProgressChanged会在每个分片的响应时触发一次,该响应可能包含多个文档,因此ProcessedDocuments的增量可能大于一。
如何获取更新
NuGet
- NuGet – 安装最新的包。它适用于 .NET 和 .NET Framework 项目,并会自动为目标框架选择相应的构建:.NET Framework 4.6.2 或 4.8、.NET Standard 2.1、.NET 6.0、.NET 8.0 或 .NET 10.0。
# Package Manager
NuGet\Install-Package GroupDocs.Search -Version 26.11.0
# .NET CLI
dotnet add package GroupDocs.Search --version 26.11.0
直接下载
-
Direct Download – 从官方发布页面下载针对 .NET 和 .NET Framework 的编译程序集:
https://releases.groupdocs.com/search/net/new-releases/groupdocs.search-for-.net-26.11-dlls-only/
https://releases.groupdocs.com/search/net/new-releases/groupdocs.search-for-.net-26.11/
资源
- 完整发行说明 – https://releases.groupdocs.com/search/net/release-notes/2026/groupdocs-search-for-net-26-11-release-notes/
- 迁移说明 – https://docs.groupdocs.com/search/net/migration-notes/#migrating-to-version-2611
- 文档 – https://docs.groupdocs.com/search/net/
- 代码示例 – https://github.com/groupdocs-search/GroupDocs.Search-for-.NET/
- Free Support Forum – https://forum.groupdocs.com/c/search/
- 从 AI 代理使用 – GroupDocs.Search MCP 服务器在本地为 Claude、Cursor 和 Copilot 运行此引擎:https://docs.groupdocs.com/search/mcp/ · Do you need a vector database to ask questions about a folder of documents?