Lucene.Net
4.8.0-beta00012
See the version list below for details.
dotnet add package Lucene.Net --version 4.8.0-beta00012
NuGet\Install-Package Lucene.Net -Version 4.8.0-beta00012
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00012" />
paket add Lucene.Net --version 4.8.0-beta00012
#r "nuget: Lucene.Net, 4.8.0-beta00012"
// Install Lucene.Net as a Cake Addin #addin nuget:?package=Lucene.Net&version=4.8.0-beta00012&prerelease // Install Lucene.Net as a Cake Tool #tool nuget:?package=Lucene.Net&version=4.8.0-beta00012&prerelease
Lucene.NET is a full-text search engine library capable of advanced text analysis, indexing, and searching. It can be used to easily add search capabilities to applications. Lucene.Net is a C# port of the popular Java Lucene search engine framework from The Apache Software Foundation, targeting the .NET platform.
Quick Start
Prerequisites
Imports
using Lucene.Net.Analysis.Standard;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using Lucene.Net.Search;
using Lucene.Net.Store;
using Lucene.Net.Util;
Create an Index and Define a Text Analyzer
// Ensures index backward compatibility
const LuceneVersion AppLuceneVersion = LuceneVersion.LUCENE_48;
// Construct a machine-independent path for the index
var basePath = Environment.GetFolderPath(
Environment.SpecialFolder.CommonApplicationData);
var indexPath = Path.Combine(basePath, "index");
using var dir = FSDirectory.Open(indexPath);
// Create an analyzer to process the text
var analyzer = new StandardAnalyzer(AppLuceneVersion);
// Create an index writer
var indexConfig = new IndexWriterConfig(AppLuceneVersion, analyzer);
using var writer = new IndexWriter(dir, indexConfig);
Add to the Index
var source = new
{
Name = "Kermit the Frog",
FavoritePhrase = "The quick brown fox jumps over the lazy dog"
};
var doc = new Document
{
// StringField indexes but doesn't tokenize
new StringField("name",
source.Name,
Field.Store.YES),
new TextField("favoritePhrase",
source.FavoritePhrase,
Field.Store.YES)
};
writer.AddDocument(doc);
writer.Flush(triggerMerge: false, applyAllDeletes: false);
Construct a Query
// Search with a phrase
var phrase = new MultiPhraseQuery
{
new Term("favoritePhrase", "brown"),
new Term("favoritePhrase", "fox")
};
Fetch the Results
// Re-use the writer to get real-time updates
using var reader = writer.GetReader(applyAllDeletes: true);
var searcher = new IndexSearcher(reader);
var hits = searcher.Search(phrase, 20 /* top 20 */).ScoreDocs;
// Display the output in a table
Console.WriteLine($"{"Score",10}" +
$" {"Name",-15}" +
$" {"Favorite Phrase",-40}");
foreach (var hit in hits)
{
var foundDoc = searcher.Doc(hit.Doc);
Console.WriteLine($"{hit.Score:f8}" +
$" {foundDoc.Get("name"),-15}" +
$" {foundDoc.Get("favoritePhrase"),-40}");
}
Documentation
See the API documentation for Lucene.NET 4.8.0.
All Packages
- Lucene.Net - Core library
- Lucene.Net.Analysis.Common - Analyzers for indexing content in different languages and domains
- Lucene.Net.Analysis.Kuromoji - Japanese Morphological Analyzer
- Lucene.Net.Analysis.Morfologik - Analyzer for dictionary stemming, built-in Polish dictionary
- Lucene.Net.Analysis.OpenNLP - OpenNLP Library Integration
- Lucene.Net.Analysis.Phonetic - Analyzer for indexing phonetic signatures (for sounds-alike search)
- Lucene.Net.Analysis.SmartCn - Analyzer for indexing Chinese
- Lucene.Net.Analysis.Stempel - Analyzer for indexing Polish
- Lucene.Net.Benchmark - System for benchmarking Lucene
- Lucene.Net.Classification - Classification module for Lucene
- Lucene.Net.Codecs - Lucene codecs and postings formats
- Lucene.Net.Expressions - Dynamically computed values to sort/facet/search on based on a pluggable grammar
- Lucene.Net.Facet - Faceted indexing and search capabilities
- Lucene.Net.Grouping - Collectors for grouping search results
- Lucene.Net.Highlighter - Highlights search keywords in results
- Lucene.Net.ICU - Specialized ICU (International Components for Unicode) Analyzers and Highlighters
- Lucene.Net.Join - Index-time and Query-time joins for normalized content
- Lucene.Net.Memory - Single-document in-memory index implementation
- Lucene.Net.Misc - Index tools and other miscellaneous code
- Lucene.Net.Queries - Filters and Queries that add to core Lucene
- Lucene.Net.QueryParser - Text to Query parsers and parsing framework
- Lucene.Net.Replicator Files replication utility
- Lucene.Net.Sandbox - Various third party contributions and new ideas
- Lucene.Net.Spatial - Geospatial search
- Lucene.Net.Suggest - Auto-suggest and Spell-checking support
- Lucene.Net.TestFramework - Framework for testing Lucene-based applications
Demos & Tools
There are several demos implemented as simple console applications that can be copied and pasted into Visual Studio or compiled on the command line in the Lucene.Net.Demo project.
There is also a dotnet command line tool available on NuGet. It contains all of the demos as well as tools maintaining your Lucene.NET index, featuring operations such as splitting, merging, listing segment info, fixing, deleting segments, upgrading, etc. Always be sure to back up your index before running any commands against it!
dotnet tool install lucene-cli -g --version 4.8.0-beta00015
NOTE: The version of the CLI you install should match the version of Lucene.NET you use.
Once installed, you can explore the commands and options that are available by entering the command lucene
.
Lucene.NET Needs Your Help
Lucene.NET 4.8.0 is a large project that has been under development since 2014, and a few volunteers have contributed more than 5000 hours of their time to help. All of the Lucene.NET modules are ported from Java, but we are still missing a few key features and have much work to do on our biggest dependency, ICU4N, to get it production ready.
If you wish to contribute your time, please see the Contributing page to get started. Specifically, the types of people we need to get Lucene.NET 4.8.0 out of beta are:
- An engineer with advanced concurrency debugging and design skills
- Someone with experience fund raising for open source
- Some developers to experiment with and blog about Lucene.NET and to help us make the user experience better by creating more documentation
Sponsor Lucene.NET
We understand some people and companies don't have the time to contribute code or write documentation, but still wish to participate. While Apache provides much of the infrastructure we need through Apache sponsorship programs, these funds generally are not applied toward development work of Lucene.NET.
Being that Lucene.NET has over 450,000 lines of code and depends on several other projects that we also maintain, development on Lucene.NET is no small endeavor. It can be difficult for a small team of developers to put in the kind of time that a project of this magnitude requires, which is why we need your help. Lucene.NET needs more regular developers devoting periodic blocks of development time and it needs sponsorships so some of those developers can allocate substantial amounts of time to the project.
Please Sponsor Our Development Team! | ||
---|---|---|
Shad Storhaug | ||
Shannon Deminick | ||
Ron Clabo |
* (additional regular contributors will be featured here)
Disclaimer
These sponsorships are not officially affiliated with the Apache Software Foundation, but aim to support endeavors related to Apache Lucene.NET. The ASF values community integrity and vendor independence very highly. As a general principle, it doesn't accept "cash for code" so that individual cash payments can't force contributions into a project which aren't aligned with community consensus.
Plans
Some of the developments we may be able to accelerate through this initiative include:
- Performance optimization.
- Fixing tests that are still failing intermittently.
- Finish ICU4N packaging, and provide a way to make smaller custom distributions of ICU data using the ICU Data Build Tool.
- Automation of website and API documentation build and deployment.
- Online API documentation for J2N.
- Production release of Lucene.NET 4.8.0.
- Upgrade of Lucene.NET from 4.8.0 to the latest stable version of Lucene (approximately 1800 hours of work).
Funding may also be applied toward:
- Ongoing support of Lucene.NET 4.8.0 and higher.
- Development hardware and virtualization of debugging environments.
- Reporting bugs found in .NET platform and development tools.
- Documenting policies and procedures for use by the Lucene.NET development team.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 is compatible. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. 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. |
-
.NETFramework 4.5
- J2N (>= 2.0.0-beta-0009)
- Microsoft.Extensions.Configuration.Abstractions (>= 1.1.2)
-
.NETStandard 2.0
- J2N (>= 2.0.0-beta-0009)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.3)
-
.NETStandard 2.1
- J2N (>= 2.0.0-beta-0009)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.3)
NuGet packages (183)
Showing the top 5 NuGet packages that depend on Lucene.Net:
Package | Downloads |
---|---|
Lucene.Net.Analysis.Common
Analyzers for indexing content in different languages and domains for the Lucene.NET full-text search engine library from The Apache Software Foundation. Documentation: https://lucenenet.apache.org/docs/4.8.0-beta00016/api/analysis-common/overview.html This package is part of the Lucene.NET project: https://www.nuget.org/packages/Lucene.Net/4.8.0-beta00016 |
|
Lucene.Net.Queries
Extended Filters and Queries for the Lucene.NET full-text search engine library from The Apache Software Foundation. Documentation: https://lucenenet.apache.org/docs/4.8.0-beta00016/api/queries/Lucene.Net.Queries.html This package is part of the Lucene.NET project: https://www.nuget.org/packages/Lucene.Net/4.8.0-beta00016 |
|
Lucene.Net.Sandbox
Various third party contributions and new ideas extensions for the Lucene.NET full-text search engine library from The Apache Software Foundation. Documentation: https://lucenenet.apache.org/docs/4.8.0-beta00016/api/sandbox/overview.html This package is part of the Lucene.NET project: https://www.nuget.org/packages/Lucene.Net/4.8.0-beta00016 |
|
Lucene.Net.Grouping
Collectors for grouping search results for the Lucene.NET full-text search engine library from The Apache Software Foundation. Documentation: https://lucenenet.apache.org/docs/4.8.0-beta00016/api/grouping/package.html This package is part of the Lucene.NET project: https://www.nuget.org/packages/Lucene.Net/4.8.0-beta00016 |
|
Lucene.Net.Replicator
Replicator that allows replication of files between a server and client(s) for the Lucene.NET full-text search engine library from The Apache Software Foundation. Documentation: https://lucenenet.apache.org/docs/4.8.0-beta00016/api/replicator/Lucene.Net.Replicator.html This package is part of the Lucene.NET project: https://www.nuget.org/packages/Lucene.Net/4.8.0-beta00016 |
GitHub repositories (33)
Showing the top 5 popular GitHub repositories that depend on Lucene.Net:
Repository | Stars |
---|---|
OrchardCMS/OrchardCore
Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
|
|
ravendb/ravendb
ACID Document Database
|
|
OrchardCMS/Orchard
Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
|
|
DynamoDS/Dynamo
Open Source Graphical Programming for Design
|
|
NuGet/NuGetGallery
NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
|
Version | Downloads | Last updated |
---|---|---|
4.8.0-beta00016 | 5,317,687 | 2/17/2022 |
4.8.0-beta00015 | 580,219 | 10/29/2021 |
4.8.0-beta00014 | 3,847,475 | 3/28/2021 |
4.8.0-beta00013 | 460,752 | 11/16/2020 |
4.8.0-beta00012 | 167,202 | 9/19/2020 |
4.8.0-beta00011 | 77,849 | 7/24/2020 |
4.8.0-beta00010 | 9,405 | 7/19/2020 |
4.8.0-beta00009 | 18,546 | 6/30/2020 |
4.8.0-beta00008 | 158,611 | 5/5/2020 |
4.8.0-beta00007 | 699,850 | 12/29/2019 |
4.8.0-beta00006 | 257,227 | 8/13/2019 |
4.8.0-beta00005 | 879,247 | 10/24/2017 |
4.8.0-beta00004 | 220,432 | 5/21/2017 |
4.8.0-beta00001 | 22,820 | 5/9/2017 |
3.0.3 | 14,304,571 | 10/26/2012 |
2.9.4.1 | 3,915,418 | 12/2/2011 |
2.9.2.2 | 627,271 | 9/30/2011 |