Lucene.Net.ObjectMapping
1.1.1-beta
dotnet add package Lucene.Net.ObjectMapping --version 1.1.1-beta
NuGet\Install-Package Lucene.Net.ObjectMapping -Version 1.1.1-beta
<PackageReference Include="Lucene.Net.ObjectMapping" Version="1.1.1-beta" />
paket add Lucene.Net.ObjectMapping --version 1.1.1-beta
#r "nuget: Lucene.Net.ObjectMapping, 1.1.1-beta"
// Install Lucene.Net.ObjectMapping as a Cake Addin #addin nuget:?package=Lucene.Net.ObjectMapping&version=1.1.1-beta&prerelease // Install Lucene.Net.ObjectMapping as a Cake Tool #tool nuget:?package=Lucene.Net.ObjectMapping&version=1.1.1-beta&prerelease
Mapping of .NET objects to Lucene.Net Documents and vice versa
Uses JSON Serialization to store the object in the Lucene.Net Document, and indexes each property (also nested properties) individually.
Any object that is JSON serializable (using Newtonsoft.Json) can be mapped to a Document, like this:
Document doc = myObject.ToDocument();
Similarly, a Document created like called out above can be converted back into an object like this:
MyClass myObject = doc.ToObject<MyClass>();
// or
object myObject = doc.ToObject();
Since the library stores the actual type of the object when creating a Document,
we can always reconstruct the same type of object when deserializing using
ToObject
, provided that the types can be deserialized from JSON.
You can add your documents to your indices the usual way, or you can add an object to an IndexWriter like this:
myIndexWriter.Add(myObject);
// or
myIndexWriter.Add(myObject, myAnalyzer);
Updating existing documents is just as easy. Like the UpdateDocument
method on
the IndexReader
, it will delete the documents that match the given query and
then just add the new document. Use it like this:
myIndexWriter.Update(myObject, new TermQuery(new Term("Id", myObject.Id)));
// or
myIndexWriter.Update(myObject, new TermQuery(new Term("Id", myObject.Id)), myAnalyzer);
Please note that it is not necessary to filter for the document type in your
query. The Update
method does it automatically.
Search for Documents mapped from a specifc class using the extensions to the Searcher, e.g. like this:
mySearcher.Search<MyClass>(myQuery, numResultsToReturn, mySort);
There are other extensions to the Searcher to, also non-generic ones just in case.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Lucene.Net (>= 4.8.0-beta00016)
- Lucene.Net.Analysis.Common (>= 4.8.0-beta00016)
- Lucene.Net.Queries (>= 4.8.0-beta00016)
- Newtonsoft.Json (>= 13.0.3)
-
net6.0
- Lucene.Net (>= 4.8.0-beta00016)
- Lucene.Net.Analysis.Common (>= 4.8.0-beta00016)
- Lucene.Net.Queries (>= 4.8.0-beta00016)
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Lucene.Net (>= 4.8.0-beta00016)
- Lucene.Net.Analysis.Common (>= 4.8.0-beta00016)
- Lucene.Net.Queries (>= 4.8.0-beta00016)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.1.1-beta | 316 | 5/16/2024 | |
1.1.0-rc3 | 10,998 | 12/25/2017 | |
1.1.0-rc2 | 966 | 12/18/2017 | |
1.1.0-rc1 | 1,059 | 9/5/2015 | |
1.1.0-alpha | 1,056 | 5/2/2015 |