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