![]() |
VOOZH | about |
dotnet add package EasyLuceneNET --version 1.5.0
NuGet\Install-Package EasyLuceneNET -Version 1.5.0
<PackageReference Include="EasyLuceneNET" Version="1.5.0" />
<PackageVersion Include="EasyLuceneNET" Version="1.5.0" />Directory.Packages.props
<PackageReference Include="EasyLuceneNET" />Project file
paket add EasyLuceneNET --version 1.5.0
#r "nuget: EasyLuceneNET, 1.5.0"
#:package EasyLuceneNET@1.5.0
#addin nuget:?package=EasyLuceneNET&version=1.5.0Install as a Cake Addin
#tool nuget:?package=EasyLuceneNET&version=1.5.0Install as a Cake Tool
基于https://github.com/SilentCC/JIEba-netcore 封装了一个lucene.net的全文检索工具
Install-Package EasyLuceneNET
public class Article
{
[Lucene(FieldStore = Field.Store.YES, IsUnique = true, type = LuceneFieldType.Int32)]
public int Id { get; set; }
[Lucene(FieldStore = Field.Store.YES, IsUnique = false, type = LuceneFieldType.Text)]
public string Title { get; set; }
[Lucene(FieldStore = Field.Store.YES, IsUnique = false, type = LuceneFieldType.Text)]
public string Content { get; set; }
}
var service = new ServiceCollection();
service.AddLogging();
service.AddEasyLuceneNet();
var serviceProvider = service.BuildServiceProvider();
var easy = serviceProvider.GetService<IEasyLuceneNet>();
var list = new List<Article>();
for (int i = 0; i < 100; i++)
{
list.Add(new Article()
{
Id = i,
Title = i + "使用Xamarin开发移动应用示例——数独游戏(八)使用MVVM实现完成游戏列表页面",
Content = @"前面我们已经完成了游戏的大部分功能,玩家可以玩预制的数独游戏,也可以自己添加新的游戏。现在我们实现展示已完成游戏列表页面,显示用户已经完成的游戏列表,从这个列表可以进入详细的复盘页面。
前面的页面我们采用的是传统的事件驱动模型,在XAML文件中定义页面,在后台的cs文件中编写事件响应代码。采用这种模型是因为很多页面需要动态生成控件,然后动态改变这些控件的属性,事件驱动模型在这种场景下比较好理解。现在我们采用MVVM方式编写完成游戏列表页面。
MVVM是将页面绑定到视图模型,所有的操作和事件响应通过视图模型完成。视图模型中没有页面控件的定义,因此和页面是解耦的,可以独立进行测试。在视图模型中我们只关心数据,而不关心展示数据的控件。
首先,我们定义一个视图模型的基类,下一步在改造其它页面时,会用到这个基类:"
});
}
easy!.AddIndex(list);
var result = easy!.Search<Article>(new SearchRequest()
{
keyword = "事件模型",
index = 1,
size = 20,
fields = new string[] { "Title", "Content" },
OrderByField = "Id",
});
Console.WriteLine("一共:" + result.Total);
foreach (var item in result.list)
{
Console.WriteLine($"id:{item.Id} title:{item.Title}");
}
Console.WriteLine($"分词:{string.Join(" ", result.cutKeys)}");
Console.WriteLine("完成");
//传递一个文档对应的模型,只需要给主键赋值即可
easy.Delete(new Article { Id = 1 });
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.