lucenenet | Apache LuceneNET | Search Engine library
kandi X-RAY | lucenenet Summary
kandi X-RAY | lucenenet Summary
Apache Lucene.NET
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of lucenenet
lucenenet Key Features
lucenenet Examples and Code Snippets
Community Discussions
Trending Discussions on lucenenet
QUESTION
I'm trying to compress the index size as much as possible, Any help please? https://lucenenet.apache.org/docs/4.8.0-beta00013/api/core/Lucene.Net.Codecs.Compressing.CompressionMode.html#Lucene_Net_Codecs_Compressing_CompressionMode_HIGH_COMPRESSION
...ANSWER
Answered 2021-Jan-22 at 21:05The 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.
QUESTION
We are upgrading from lucene.net 3.0 to 4.8. Now we have some issues because of breaking changes between these versions.
In our project, we make use of the
CustomScoreQuery
which used to be part of theLucene.Net.Search.Function
namespace. It is no longer there. According to the Apache documentation is is deprecated and should be replaced by using theFunctionScoreQuery
, but this class doesn't seem to exist in 4.8. What should we use instead?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 theSetNextReader
function, we use to do something likeLucene.Net.Search.FieldCache_Fields.DEFAULT.GetStrings(reader, "")
. This has also been removed. Apparently we need to useLucene.Net.Search.FieldCache.DEFAULT.GetTerms(context.AtomicReader, "", false)
. So this issue seems solvedWe used a class that inherited from
CustomScoreProvider
inLucene.Net.Search.Function
, but it is no longer there in 4.8. We used it combined with theCustomScoreQuery
as returnvalue for theGetCustomScoreProvider
method There doesn't seem to be any alternative. What should we use instead?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.
...ANSWER
Answered 2020-Dec-09 at 14:39I also posted my questions here, and the nice people from lucene.net answered all my questions
QUESTION
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?
...ANSWER
Answered 2020-Nov-28 at 01:38Since 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.
QUESTION
I'm trying to get the basic demo of Lucene.net (4.8.0-beta00012) to run.
http://lucenenet.apache.org/#quick-start
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.
...ANSWER
Answered 2020-Oct-11 at 15:15StandardAnalyzer
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. https://github.com/apache/lucenenet/search?p=1&q=Dump
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
QUESTION
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:
...ANSWER
Answered 2019-Feb-26 at 14:56Use Example with ContentItem.CastTo() method (or
DeliveryItemResponse.CastTo() /
DeliveryItemListingResponse.CastTo()) method with
object
as a generics.
ContentItem.CastTo()
method
QUESTION
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:
- Link to the TermsFilter source on github
- Link to the docs on apache.org
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?
...ANSWER
Answered 2017-Aug-21 at 10:15Fine. I found it released on nuget inside the Lucene.Net.Contrib package.
QUESTION
On the Lucene.Net
GitHub page (https://github.com/apache/lucenenet), 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 https://github.com/apache/lucenenet.git
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 usingNuGet Package Manager
. (TheNetStandard.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 theNetStandard.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 theNetStandard.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 theLucene.Net.project.json
file to use.NETStandard,Version=1.5
and then recompile only theLucene.Net
project. I ended up with several compile errors so I reverted the entry to its orginal value ofnet451
.- There is no
.csproj
file for any of the projects. I did not attempt to rundotnet 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!
...ANSWER
Answered 2017-May-07 at 10:16The following answer came from Shad Storhaug
on the dev@lucenenet.apache.org
mailing list.
Anthony,
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 - https://github.com/dotnet/core/blob/master/release-notes/download-archive.md Visual Studio 2015 (Community or greater) with Update 3 NUnit3 Test Adapter (if you need to run the tests) - https://marketplace.visualstudio.com/items?itemName=NUnitDevelopers.NUnit3TestAdapter
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: https://stackoverflow.com/a/1825807/181087
Or if you just want to reference the NuGet packages, we have a CI feed available at https://www.myget.org/gallery/lucene-net-ci. Pending the results of a release vote, we will have a beta available on NuGet in a couple of days.
Thanks, Shad Storhaug (NightOwl888)
QUESTION
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?
...ANSWER
Answered 2017-Mar-27 at 00:14For 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
Vulnerabilities
No vulnerabilities reported
Install lucenenet
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page