This is a simple RESTful services for searching File.
- JDK 1.8.x
- Maven 3.x
- Lucene 5.5.x for Lucene Index
- Java IDE, Spring Tool Suite is heavily recommended for best Spring integration
-
Import the project into an IDE as "Existing Maven Project"
-
Create an application.properties file in the config folder with your Lucene index location and port number. Refer to application.properties
###Example
#Path to Lucene index directory
lucene.index.location=D:\files\
And copy the example files Test1.txt and Test2.txt to the above filder for testing. In production it will be the real files.
-
Run -> mvn clean package
-
The build should run successfully and generate a runnable jar in the target folder. This can be run via terminal, or in Spring Tool Suite click Run As "Spring Boot App"
The services may be accessed via HTTP requests. They return data in JSON format.
-
Type: GET
-
Path: /search?query=<Lucene_Query>&count=<150|all> - Query string is a lucene format.
https://lucene.apache.org/core/2_9_4/queryparsersyntax.html
- Example Tests:
Single word:
http://localhost:9090/search?query=contents:bloganathan
Multiple Word:
http://localhost:9090/search?query=contents:"Test23" contents:"Test1"