lunr core
2.3.10
lunr.js到.NET核心的港口。 Lunr有点像Solr,但要小得多,也不那么明亮。
可以使用以下内容创建一个非常简单的搜索索引:
var index = await Index . Build ( async builder =>
{
builder
. AddField ( " title " )
. AddField ( " body " ) ;
await builder . Add ( new Document
{
{ " title " , " Twelfth-Night " } ,
{ " body " , " If music be the food of love, play on: Give me excess of it… " } ,
{ " author " , " William Shakespeare " } ,
{ " id " , " 1 " } ,
} ) ;
} ) ;
然后,搜索就像:
await foreach ( Result result in index . Search ( " love " ) )
{
// do something with that result
}
这将返回匹配文档的列表,其得分的匹配程度,搜索查询以及有关比赛的任何相关元数据:
new List < Result >
{
new Result (
documentReference : " 1 " ,
score : 0.3535533905932737 ,
matchData : new MatchData (
term : " love " ,
field : " body "
)
)
}
Lunr-core是一个小型的全文搜索库,可用于小型应用程序。它索引文档并为检索最佳匹配文本查询的文档提供了一个简单的搜索界面。它与lunr.js 100%兼容,这意味着可以使用lunr.js在客户端上使用LUNR核心准备的索引文件。
LUNR核心适用于需要简单的搜索引擎但没有全尺寸搜索引擎(例如Lucene)的开销的小型应用程序。它与lunr.js的兼容性也打开了一些有趣的客户端搜索方案。