lucenenet | Apache LuceneNET | Search Engine library

 by   apache C# Version: Lucene.Net_4_8_0_beta00016 License: Apache-2.0

kandi X-RAY | lucenenet Summary

kandi X-RAY | lucenenet Summary

lucenenet is a C# library typically used in Database, Search Engine applications. lucenenet has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

Apache Lucene.NET

            kandi-support Support

              lucenenet has a medium active ecosystem.
              It has 1997 star(s) with 627 fork(s). There are 179 watchers for this library.
              It had no major release in the last 12 months.
              There are 66 open issues and 172 have been closed. On average issues are closed in 75 days. There are 11 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of lucenenet is Lucene.Net_4_8_0_beta00016

            kandi-Quality Quality

              lucenenet has 0 bugs and 0 code smells.

            kandi-Security Security

              lucenenet has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              lucenenet code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              lucenenet is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              lucenenet releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.
              lucenenet saves you 1591 person hours of effort in developing the same functionality from scratch.
              It has 3537 lines of code, 0 functions and 3770 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of lucenenet
            Get all kandi verified functions for this library.

            lucenenet Key Features

            No Key Features are available at this moment for lucenenet.

            lucenenet Examples and Code Snippets

            No Code Snippets are available at this moment for lucenenet.

            Community Discussions


            How to use HIGH_COMPRESSION in Lucene.Net 4.8
            Asked 2021-Jan-22 at 21:05


            Answered 2021-Jan-22 at 21:05

            The first thing to know is that there are many aspects to the "Lucene Index". When not using compound files, this manifests in the various files that are created. Just looking at two of those, we can talk about the inverted index which is called postings and we can talk about the stored documents. Of these two, there aren't any readily available tunable settings regarding the compression of the inverted index as best I can tell.

            The HIGH_COMPRESSION mode relates to the stored fields. If you are not storing fields and you are only using Lucene.Net to create an inverted index then doing work to turn on high compression for stored fields won't reduce the size of the "Lucene Index".

            That said, if you are storing fields and want to use high compression on that stored fields data, then you will need to create your own codec that has high compression turned on for stored fields. And to do that, you will first need a Stored fields class that has high compression turned on. Below are those two classes followed by a unit test that uses this new codec that I have written for you. I haven't tried this code on a large amount of data to see the effect, I leave that for you as an exercise, but this should point the way to getting your stored fields compressed with High Compression.



            Migrate from 3.0 to 4.8
            Asked 2020-Dec-09 at 14:39

            We are upgrading from 3.0 to 4.8. Now we have some issues because of breaking changes between these versions.

            1. In our project, we make use of the CustomScoreQuery which used to be part of the Lucene.Net.Search.Function namespace. It is no longer there. According to the Apache documentation is is deprecated and should be replaced by using the FunctionScoreQuery, but this class doesn't seem to exist in 4.8. What should we use instead?

            2. We used a custom collector class, that inherited from Lucene.Net.Search.Collector. In 4.8, this class has become sealed. I see there a several implementation classes. Which one should I use?

              I discovered I need to use the ICollector interface. Which partly solves the problem. In the SetNextReader function, we use to do something like Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStrings(reader, ""). This has also been removed. Apparently we need to use Lucene.Net.Search.FieldCache.DEFAULT.GetTerms(context.AtomicReader, "", false). So this issue seems solved

            3. We used a class that inherited from CustomScoreProvider in Lucene.Net.Search.Function, but it is no longer there in 4.8. We used it combined with the CustomScoreQuery as returnvalue for the GetCustomScoreProvider method There doesn't seem to be any alternative. What should we use instead?

            4. We used a WhitespaceAnalyzer in 3.0, Which doesn't seem to be there anymore. What is the replacement for that?

            There is some documentation, but unfortunately the link to the migration guide is still a TODO.



            Answered 2020-Dec-09 at 14:39

            I also posted my questions here, and the nice people from answered all my questions



            ASP.NET Core - Indexing and searching JSON files
            Asked 2020-Nov-28 at 01:38

            I have close to 10K JSON files (very small). I would like to provide search functionality. Since these JSON files are fixed for specific release, I am thinking to pre-index files and load index during startup of website. I don't want to use external search engine.

            I am searching for libraries to support this. lucene.Net is one popular library. I am not sure whether this library supports loading pre-index data.

            • Index JSON documents and store index results (probably in single file), save to file storage service like S3 - Console app.
            • Load index file and respond to queries. - ASP.NET core app

            I am not sure this is possible or not. What are the possible options available?



            Answered 2020-Nov-28 at 01:38

            Since S3 is not a .NET-specific technology and Lucene.NET is a line-by-line port of Lucene, you can expand your search to include Lucene-related questions. There is an answer here that points to an S3 implementation meant for Lucene that could be ported to .NET. But, by the author's own admission, performance of the implementation is not great.

            NOTE: I don't consider this to be a duplicate question due to the fact that the answer most appropriate to you is not the accepted answer, since you explicitly stated you don't want to use an external solution.

            There are a couple of implementations for Lucene.NET that use Azure instead of AWS here and here. You may be able to get some ideas that help you to create a more optimal solution for S3, but creating your own Directory implementation is a non-trivial task.

            Can IndexReader read index file from in-memory string?

            It is possible to use a RAMDirectory, which has a copy constructor that moves the entire index from disk into memory. The copy constructor is only useful if your files are on disk, though. You could potentially read the files from S3 and put them into RAMDirectory. This option is fast for small indexes but will not scale if your index is growing over time. It is also not optimized for high-traffic websites that have multiple concurrent threads performing searches.

            From the documentation:

            Warning: This class is not intended to work with huge indexes. Everything beyond several hundred megabytes will waste resources (GC cycles), because it uses an internal buffer size of 1024 bytes, producing millions of byte[1024] arrays. This class is optimized for small memory-resident indexes. It also has bad concurrency on multithreaded environments.

            It is recommended to materialize large indexes on disk and use MMapDirectory, which is a high-performance directory implementation working directly on the file system cache of the operating system, so copying data to heap space is not useful.

            When you call the FSDirectory.Open() method, it chooses a directory that is optimized for the current operating system. In most cases it returns MMapDirectory, which is an implementation that uses the System.IO.MemoryMappedFiles.MemoryMappedFile class under the hood with multiple views. This option will scale much better if the size of the index is large or if there are many concurrent users.

            To use Lucene.NET's built-in index file optimizations, you must put the index files in a medium that can be read like a normal file system. Rather than trying to roll a Lucene.NET solution that uses S3's APIs, you might want to check into using S3 as a file system instead. Although, I am not sure how that would perform compared to a local file system.



            Newbie Lucene Problem with c# demo "The Type or Namespace 'StandardAnalyzer' could not be found"
            Asked 2020-Oct-11 at 15:15

            I'm trying to get the basic demo of (4.8.0-beta00012) to run.


            I've created a new Forms App.

            Run Install-Package Lucene.Net -Pre and it's downloaded the nuget package.

            Copied and pasted all the demo sections: Create an index and define a text analyzer, Add to the index, Construct a query, and Fetch the results.

            Visual Studio popped up a load of missing assembly references so I clicked 'Potential Fixes' and let it add the using statements at the start.



            Answered 2020-Oct-11 at 15:15

            StandardAnalyzer is located in namespace Lucene.Net.Analysis.Standard.

            I don't have an answer for you with regard to .Dump exactly. hit.Score is a float, so hit.Score.Dump("Score"); is a bit hard for me to imagine. I did a search of the lucene net repository for the word Dump and there are only 20 occurrences.

            One of them is the code tutorial example you are citing. But none of the other occurrences appear to be the implementation of that Dump method. So I'm gonna guess that the .Dump is no longer a valid method for the uses cited.

            I'd recommend changing



            Cast ContentItem to the strongly type
            Asked 2019-Sep-23 at 12:15

            I'm building a site using Kentico Cloud with .Net SDK providing search functionality using the Lucene.Net to store index items.

            I would like to create strongly typed model from DeliveryClient.ContentItem in the search implementation.

            I have implemented the like that:



            Answered 2019-Feb-26 at 14:56

            Use ContentItem.CastTo() method (or DeliveryItemResponse.CastTo() / DeliveryItemListingResponse.CastTo()) method with object as a generics.

            Example with ContentItem.CastTo() method



            Cannot find TermsFilter class in Lucene.NET 3.0.3
            Asked 2017-Aug-21 at 10:15

            I downloaded the latest nuget for Lucene.NET 3.0.3 (stable, not the 4.0 beta) and I simply cannot find TermsFilter in any of the releases.

            It appears to be within the repo:

            Some users have recommended looking in the "lucene-contrib.jar" but those instructions are for the original Java Lucene. The .NET version has no "contribs" release so I don't know how to find those classes.

            So where can I find TermsFilter for Lucene.NET 3.0.3? Do I have to build from source?



            Answered 2017-Aug-21 at 10:15

            Fine. I found it released on nuget inside the Lucene.Net.Contrib package.



            Using Apache Lucene.Net 4.8.0 with .NET Standard 1.5 and Visual Studio 2017
            Asked 2017-May-07 at 10:16

            On the Lucene.Net GitHub page (, it says that version 4.8.0 (the beta version currently available on GitHub) is compatible with the .Net Standard 1.5 and .Net 4.5.1 frameworks. Fantastic!

            I did a git clone to pull the code. The solution opened right up and compiled in Visual Studio 2017 with no errors under the default framework of .NET 4.5.1. All is well thus far.

            What I really need is to compile Lucene.NET 4.8.0 to work with .NET Core 1.1.x. This is where things kind of went a bit sideways.

            When I opened up the properties page for the Lucene.Net project (as well as the many other included projects), they are all referencing the default .NET 4.5.1. There does not appear to be any option to reference .NET Standard 1.x or .NET Core 1.x.y instead of a standard .NET framework version.

            I am sure this must be a really simple fix, but I am at a bit of a loss as to how get Lucene.Net working with .Net Standard / .Net Core.

            Here are a few quick notes that might be of interest.

            • The latest Dot Net Core SDK is installed on my machine.
            • I installed the NetStandard.Library to all projects using NuGet Package Manager. (The NetStandard.Library appears in the references for all projects with a blue and white icon. The solution still compiles but I am unable to drill down and see the constituent files in the NetStandard.Library as I can with other .NET Standard or .NET Core projects.)
            • I ran dotnet restore just in case that might have been needed to pull the various files needed for the NetStandard.Library.
            • All of the projects in the solution contain [projectname].project.json files. After installing the NetStandard.Library to each project, there is now a dependencies entry in the [projectname].project.json file.

              "dependencies": { "NETStandard.Library": "1.6.1" }

            • I did attempt to update just the framework entry in the Lucene.Net.project.json file to use .NETStandard,Version=1.5 and then recompile only the Lucene.Net project. I ended up with several compile errors so I reverted the entry to its orginal value of net451.

            • There is no .csproj file for any of the projects. I did not attempt to run dotnet migrate as I was unsure if it was necessary, and I did not want to introduce additional variables.

            Any help here is much appreciated. Thank you so much!



            Answered 2017-May-07 at 10:16

            The following answer came from Shad Storhaug on the mailing list.


            Since NUnit3 Test Adapter does not yet support it on .NET Core, we have not yet upgraded to the new .csproj format that supports Visual Studio 2017. For the time being we have 2 separate solution files.

            Lucene.Net.sln - for .NET Framework 4.5.1 Lucene.Net.Portable.sln - for .NET Standard 1.5

            You can open up Lucene.Net.Portable.sln in Visual Studio 2015, but it is not compatible with VS2017.

            Prerequisites for VS2015:

            1.1 with SDK Preview 2.1 build 3177 - Visual Studio 2015 (Community or greater) with Update 3 NUnit3 Test Adapter (if you need to run the tests) -

            To get it to compile on .NET Standard you may need to run dotnet restore with Visual Studio closed, and then open the Lucene.Net.Portable.sln solution in Visual Studio to build. It does not always succeed when VS2015 runs the restore or if VS2015 has the solution open when you run dotnet restore from the CLI.

            Generally speaking, this setup is only required if you want to debug Lucene.Net or help contribute to our efforts. If you just want to build you can build via CLI from the root of the project:

            Build -pv:4.8.0-beta00001

            Which will install the required SDK automatically, build DLLs for both frameworks and package them up as .nupkg files in the release\NuGetPackages folder. Make sure you have a recent version of Powershell before you run this command (still trying to work out some issues with earlier versions, but I know it works for sure with 5.1.14393.1066). To determine what version of Powershell you have:

            Or if you just want to reference the NuGet packages, we have a CI feed available at Pending the results of a release vote, we will have a beta available on NuGet in a couple of days.

            Thanks, Shad Storhaug (NightOwl888)



            Why would the BooleanFilter not appear to be available to me?
            Asked 2017-Mar-27 at 00:14

            I have installed the Lucene.Net nuget package into a class library targeting .NET Framework 4.5.2. I've been able to create an index, and also have been able to construct a query with a filter to search the index.

            I now need to combine multiple filters, and was hoping to use the BooleanFilter.

            Unless I'm misunderstanding the documents, Lucene.Net's BooleanFilter should be available in the Lucene.Net.Search namespace. I can see other classes in this namespace, but I can't see BooleanFilter.

            Why would this be?



            Answered 2017-Mar-27 at 00:14

            For Lucene.Net 3.0.3 and prior, the BooleanFilter is in the Lucene.Net.Contrib nuget package in the Lucene.Net.Queries namespace.

            For Lucene.Net 4.8.0 beta, BooleanFilter is available in the Lucene.Net.Queries package under the Lucene.Net.Queries namespace.

            For the complete listing of available continuous integration packages for the next gen of Lucene.Net, see the gallery page.

            So, no it doesn't look like you are misunderstanding the documentation - the documentation is wrong.


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install lucenenet

            You can download it from GitHub.


            We now have some preliminary documentation for Lucene.NET 4.8.0 on the Lucene.NET Website. The API is similar to Java Lucene 4.8.0, which you may also find helpful to review. NOTE: We are working on fixing issues with the documentation, but could use more help since it is a massive project. See #206.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link