The solution I was searching for for was based on this library.
{"couchdb-lucene":"Welcome","version":"1.1.0-SNAPSHOT"}
To make it run I had to build it in the root directory with mvn and then navigate to target and run command ./bin/run in the unzipped couchdb-lucene:
root@mario-VirtualBox:/home/mario/CouchDB_mario/couchdb-lucene/target/couchdb-lucene-1.1.0-SNAPSHOT# ./bin/run
All what you need to have there is the following piece of code:
[httpd_global_handlers]
_fti = {couch_httpd_proxy, handle_proxy_req, <<"http://localhost:5985">>}
Thanks to which, I was able to finally query CouchDB using Apache Lucene indexing.
curl -X PUT http://localhost:5984/user14169_slovnik_medical/_design/medical -d @user14169_slovnik_medical.json
Where the JSON Design Document looked like this:
{
"_id": "_design/medical",
"fulltext": {
"by_meaning": {
"index": "function(doc) { var ret=new Document(); ret.add(doc.vyznam); return ret }"
},
"by_shortcut": {
"index": "function(doc) { var ret=new Document(); ret.add(doc.zkratka); return ret }"
}
}
}
{ "_id": "63e5c848fa2211c3b063d6feccd3d942", "_rev": "1-899a6924ed08097b1a37e497d91726fd", "DATAWORKS_DOCUMENT_TYPE": "user14169_slovnik_medical", "vyznam": "End to side", "zkratka": "e-t-s" }
Then you are easiliy able to achieve queries like this:
http://localhost:5984/_fti/local/user14169_slovnik_medical/_design/medical/by_meaning?q=lob~
Which returns the expected data:
The local prefix is because I am running the database on localhost on 1 node and by default couchdb-lucene is connecting to the localhost.
The coolest thing is that you are able to use client API org.lightcouch jar library in Java and do some easy calls like this:
CouchDbClient dbClient = new CouchDbClient("user14169_slovnik_medical", true, "http", "127.0.0.1", 5984, null, null);
String uriFullText = dbClient.getBaseUri() + "_fti/local/user14169_slovnik_medical/_design/medical/by_shortcut?q=lob*";
JsonObject result = dbClient.findAny(JsonObject.class, uriFullText);
System.out.println(result.toString());