Lucene is an excellent search engine, but the .NET version is behind the official Java release (latest stable .NET release is 2.0, but the latest Java Lucene version is 2.4, which has more features).
How do you get around this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way I found, which was surprised could work: Create a .NET DLL from a Java .jar file! Using IKVM you can download Lucene, get the .jar file, and run:
which generates a .NET dll like this: lucene-core-2.4.0.dll
You can then just reference this DLL from your project and you’re good to go! There are some java types you will need, so also reference IKVM.OpenJDK.ClassLibrary.dll. Your code might look a bit like this:
I never knew you could have Java to .NET interoperability so easily. The best part is that C# and Java is ‘almost’ source code compatible (where Lucene examples are concerned). Just replace
System.OutwithConsole.Writeln:).=======
Update: When building libraries like the Lucene highlighter, make sure you reference the core assembly (else you’ll get warnings about missing classes). So the highlighter is built like this: