IndexRepository
IndexRepository class
表示一个容器,用于组合多个索引并对它们执行通用操作。
public class IndexRepository : IDisposable
构造函数
| 姓名 | 描述 |
|---|---|
| IndexRepository() | 初始化一个新的实例IndexRepository类. |
特性
| 姓名 | 描述 |
|---|---|
| Events { get; } | 获取用于订阅事件的事件中心。 |
| Indexes { get; } | 获取这个包含的索引IndexRepository. |
方法
| 姓名 | 描述 |
|---|---|
| AddToRepository(Index) | 将索引添加到索引存储库。 |
| AddToRepository(string) | 打开索引并将其添加到索引存储库。 |
| Create() | 在内存中创建一个新索引。 |
| Create(IndexSettings) | 在内存中创建一个新索引。 |
| Create(string) | 在磁盘上创建一个新索引。 索引文件夹将在创建索引之前被清理。 |
| Create(string, IndexSettings) | 在磁盘上创建一个新索引。 索引文件夹将在创建索引之前被清理。 |
| Dispose() | 释放所有使用的资源IndexRepository. |
| Search(SearchQuery) | 在存储库的所有索引中搜索。 |
| Search(string) | 在存储库的所有索引中搜索。 |
| Search(SearchQuery, SearchOptions) | 在存储库的所有索引中搜索。 |
| Search(string, SearchOptions) | 在存储库的所有索引中搜索。 |
| Update() | 更新存储库中的所有索引。 |
| Update(UpdateOptions) | 更新存储库中的所有索引。 |
评论
了解更多
例子
该示例演示了该类的典型用法。
string indexFolder1 = @"c:\MyIndex\";
string indexFolder2 = @"c:\MyIndex\";
string query = "Einstein";
IndexRepository repository = new IndexRepository();
repository.AddToRepository(indexFolder1); // 加载现有索引
repository.AddToRepository(indexFolder2); //加载另一个现有索引
SearchResult result = repository.Search(query); // 在存储库的索引中搜索
也可以看看
- 命名空间 GroupDocs.Search
- 部件 GroupDocs.Search