Create a starter Eclipse project to test Lucene API
Lucene is a full-text index and search engine written with Java, its the foundation of various search engine products like Solr and ElasticSearch. Sometime we may need to explore its API for learning it. This post create a starter Gradle project with Lucene support in Eclipse.
Create Gradle project in Eclipse
Select File -> New -> Project... and set Sample project as Java Quickstart
The standard project contains some sample files
We don't need these file, delete org.gralde package and create new package for example com.makble.lucenetest.
Add Lucene dependency
Add this line to sample gradle build script
First, the basic part of Lucene, if we need to try out other API of Lucene we will add it when need them, one the best practices is set the version as variable
And then add this line to dependencies closure block:
Now add a class TestLucene.java, lets create a basic unit in Lucene , a term
A term is just a pair, the two elements are field and text.
Lucene Basics tutorials
Highlight and Fragmentation