This project provides a lightweight service that wrap Lucene java implementation, for use from non-java languages.
The API provides access via HTTP calls to Lucene strong indexing and BM25 search capabilities. Specially, for querying a large scale documents or passages collection.
- Java 11
This will create a portable independent jar file in `build/libs/bm25-lucene-service-1.0-SNAPSHOT.jar'
#>git clone https://github.com/AlonEirew/bm25-lucene-service.git
#>./gradlew clean build -x test
#>java -jar bm25-lucene-service-1.0-SNAPSHOT.jar
HTTP PUT method to create Lucene index
URL - http://localhost:8085/createLuceneIndex
Json:
{
"inputPath": "src/test/resources/passages.tsv",
"indexPath": "tempIndex/test"
}
Where:
inputPath
- A tab separated value (tsv) file location in the format of:
<Passage ID> <TAB> <Passage Text>
indexPath
- The folder path to create the index in
Json:
{
"added": 5,
"indexId": "3e441154-aaf5-480f-854b-a1691569bad8",
"message": "Index created successfully"
}
Where:
added
- Number of passages/documents added to indexindexId
- Created index id for search requestsmessage
- Log information in case of failure
HTTP POST method to search a Lucene index using BM25 method
URL - http://localhost:8085/bm25Search
Json:
{
"indexId": "3e441154-aaf5-480f-854b-a1691569bad8",
"queryId": "1",
"queryText": "Hajuron Jamiri",
"topK": 5
}
Where:
indexId
- The index id given when creating the indexqueryId
- The query id for trackingqueryText
- Query text
Json:
{
"queryId": "1",
"rankedPassageIds": [
"122791"
],
"message": "Done successfully"
}
Where:
queryId
- The query id that yield this resultrankedPassageIds
- Retrieved passages/documents ids ordered by rankmessage
- Log information in case of failure
HTTP DELETE method to delete a Lucene index
URL - http://localhost:8085/deleteLuceneIndex
String:
3e441154-aaf5-480f-854b-a1691569bad8
Where: Index id to delete
Json:
{
"deleted": "true",
"message": "Index deleted successfully"
}
Where:
deleted
- Boolean indicates of success or failuremessage
- Log information in case of failure
Simple python client code snippet at example/py_code.py