Examine
v3.5.0
❤️如果您使用并喜欢检查,请考虑成为GitHub赞助商❤️
检查使您可以轻松索引和搜索数据,并包装Lucene.net索引/搜索引擎。 Lucene超级快,即使在大量数据上也可以进行非常快速的搜索。检查非常可扩展,允许您根据需要配置尽可能多的索引,并且每个索引都可以单独配置。开箱即用的检查为您提供了基于Lucene的索引实现以及可用于搜索数据的流利API。
通过Nuget
PM> Install-Package Examine
提示: IExamineManager是与检查合作的门户。这是一项在DI中注册的单例服务。
配置服务并创建索引
// Adds Examine Core services
services . AddExamine ( ) ;
// Create a Lucene based index
services . AddExamineLuceneIndex ( " MyIndex " ) ;填充索引
if ( examineManager . TryGetIndex ( " MyIndex " , out var myIndex ) )
{
// Add a "ValueSet" (document) to the index
// which can contain any data you want.
myIndex . IndexItem ( new ValueSet (
Guid . NewGuid ( ) . ToString ( ) , //Give the doc an ID of your choice
" MyCategory " , //Each doc has a "Category"
new Dictionary < string , object > ( )
{
{ " Name " , " Frank " } ,
{ " Address " , " Beverly Hills, 90210 " }
} ) ) ;
}搜索索引
var searcher = myIndex . Searcher ; // Get a searcher
var results = searcher . CreateQuery ( ) // Create a query
. Field ( " Address " , " Hills " ) // Look for any "Hills" addresses
. Execute ( ) ; // Execute the search 信息和下载以进行检查版本
文档网站在这里
提示:源代码中有许多单元测试可以用作如何做事的示例。还有一个测试Web项目,其中包含有关如何配置索引和搜索它们的大量示例。
©2023 by Shannon Deminick
这是免费软件,并获得Microsoft公共许可证(MS-PL)许可
Freepik创建的平面矢量-www.freepik.com