A simple REST-like service exposing some Redis Search functionality to support self-hosted full-text search functionality.
- A Redis Stack instance to connect to
The project is built using Gradle and a Java 21 JDK:
$ ./gradlew jlinkTar
This generates a release .tgz archive in the build/
directory which may be
used to run the service. A JRE is not needed at runtime, since this builds a
stand-alone distribution.
The service and index schema are configured using a simple YAML config file.
A sample file may be generated by simply running:
bin/minimum-effort-search > config.yml
The above will write the file config.yml
with some example parameters which
you may customise.
Thereafter, run the service with the config file as the first parameter:
bin/minimum-effort-search config.yml
The service will start up, listening on the port you specifier in the config file.
Add a single document:
POST /index/add
{
"id": "1",
"score": 1.0,
"fields": {
"title": "Blue T-Shirt",
"body": "A very basic blue t-shirt you can wear",
"price": 100,
"url": "my.site/shirts/1",
"tags": "shirt,blue,clothing"
}
}
Add multiple documents:
POST /index/addBatch
[
{
"id": "2",
"score": 1.0,
"fields": {
"title": "Jean Pant",
"more": "values"
}
},
{
"id": "3",
"fields": {
"title": "Rooi Rokkie",
"other": "fields"
}
}
]
GET /search?q=shirt&limit=10&offset=0
Parameters:
q
: Search query stringlimit
: Limit the result set to this number of documentsoffset
: Return documents starting at this offset. In combination withlimit
, allows for pagination through results.
{
"docs": [
{
"id": "1",
"payload": null,
"score": 1.0,
"fields": {
"title": "Blue T-Shirt",
"body": "A very basic blue t-shirt you can wear",
"price": 100,
"url": "my.site/shirts/1",
"tags": "shirt,blue,clothing"
}
}
],
"limit": 10,
"offset": 0,
"totalResults": 1
}