Lucene.Net 3.0.3

There is a newer prerelease version of this package available.
See the version list below for details.
Install-Package Lucene.Net -Version 3.0.3
dotnet add package Lucene.Net --version 3.0.3
<PackageReference Include="Lucene.Net" Version="3.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Lucene.Net --version 3.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Lucene.Net, 3.0.3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Lucene.Net as a Cake Addin
#addin nuget:?package=Lucene.Net&version=3.0.3

// Install Lucene.Net as a Cake Tool
#tool nuget:?package=Lucene.Net&version=3.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 3 is a C# port of the popular Java Lucene search engine framework from The Apache Software Foundation, targeting .NET Framework.

Quick Start

Create an Index and Define a Text Analyzer

// Ensures index backward compatibility
const Lucene.Net.Util.Version AppLuceneVersion = Lucene.Net.Util.Version.LUCENE_30;

// 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
using var writer = new IndexWriter(dir, analyzer, IndexWriter.MaxFieldLength.UNLIMITED);

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();
// Indexes, but doesn't tokenize
doc.Add(new Field("name", source.Name, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
doc.Add(new Field("favoritePhrase", source.FavoritePhrase, Field.Store.YES, Field.Index.ANALYZED));


writer.AddDocument(doc);
writer.Flush(triggerMerge: false, flushDocStores: false, flushDeletes: false);

Construct a Query

// Search with a phrase
var phrase = new MultiPhraseQuery();
phrase.Add(new Term("favoritePhrase", "brown"));
phrase.Add(new Term("favoritePhrase", "fox"));

Fetch the Results

// Re-use the writer to get real-time updates
using var reader = writer.GetReader();
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 3.0.3.

.NET Standard / .NET 5 / .NET 6 Support

The next generation of Lucene.NET is under development. See Lucene.Net 4.8.0.

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 Sponsor with GitHub Sponsors Sponsor with PayPal
Shannon Deminick Sponsor with GitHub Sponsors
Ron Clabo Sponsor with GitHub Sponsors


* (additional regular contributors will be featured here)

Disclamer

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.
  • Implement randomized test repeatability in the Lucene.Net.TestFramework project for easier debugging GH-288.
  • 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.

NuGet packages (134)

Showing the top 5 NuGet packages that depend on Lucene.Net:

Package Downloads
Lucene.Net.Contrib

Lucene.Net Contrib adds a set of advanced functionalites to Lucene.net, like faceted search, spatial queries, highlighters, spell check and more.

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.

Lucene.Net.Queries

Extended Filters and Queries for the Lucene.Net full-text search engine library from The Apache Software Foundation.

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.

Lucene.Net.Store.Azure

This project allows you to create Lucene Indexes via a AzureDirectory object which uses Azure BlobStorage for persistent storage. This .NET Standard compliant library for us with .NET Core or .NET Desktop. It uses Lucene.Net 4.8.0.beta00011

GitHub repositories (24)

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
NuGet/NuGetGallery
NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
NuGet/NuGet.Client
Client Tools for NuGet - including Visual Studio extensions, command line tools, and msbuild support. (Open issues on https://github.com/nuget/home/issues)
dotnet/performance
This repo contains benchmarks used for testing the performance of all .NET Runtimes
Version Downloads Last updated
4.8.0-beta00015 4,568 10/29/2021
4.8.0-beta00014 201,701 3/28/2021
4.8.0-beta00013 153,304 11/16/2020
4.8.0-beta00012 61,134 9/19/2020
4.8.0-beta00011 33,276 7/24/2020
4.8.0-beta00010 5,157 7/19/2020
4.8.0-beta00009 8,943 6/30/2020
4.8.0-beta00008 105,630 5/5/2020
4.8.0-beta00007 254,582 12/29/2019
4.8.0-beta00006 159,238 8/13/2019
4.8.0-beta00005 454,946 10/24/2017
4.8.0-beta00004 180,007 5/21/2017
4.8.0-beta00001 8,961 5/9/2017
3.0.3 7,850,972 10/26/2012
2.9.4.1 2,345,670 12/2/2011
2.9.2.2 547,142 9/30/2011