August 2018: Please note that this post was written for old versions of Lucene and CouchDB. It is left here for historical purposes only.
Last week, I had to integrate Lucene full-text search engine with CouchDB. Here are some quick handy notes in case you have to deal with this integration.
- ranked searching
- powerful query types: phrase queries, wildcard queries, proximity queries, range queries, etc
- fielded searching
- boolean operators
- sorting by any field
- allows simultaneous update and searching
Followed instructions from http://wiki.fluidproject.org/display/fluid/Setting+Up+CouchDB+and+Lucene
sudo apt-get install git-core maven2
Download the couchdb-lucene source:
git clone git://github.com/rnewson/couchdb-lucene.git
cd couchdb-lucene mvn
Copy the assembled jar file into a proper directory, and give appropiate permissions:
mkdir /var/lib/couchdb/1.0.1/lucene/ cp couchdb-lucene-0.7-SNAPSHOT-dist.zip /var/lib/couchdb/1.0.1/lucene/ cd /var/lib/couchdb/1.0.1/lucene/ unzip couchdb-lucene-0.7-SNAPSHOT-dist.zip cd .. chown -R couchdb lucene/
Setting up the integration CouchDB-Lucene
Configure the proper options in /etc/couchdb/local.ini file. Add the following parameters at the end of the file:
Install the init file to start under services:
Edit the couchdb-lucene file and set the correct location of the run script
Now you can start the service using the usual service syntax:
service couchdb-lucene start
Restart the couchdb service to apply configuration changes
service couchdb restart
Used this design document in martintest2 DB, it has a ‘title’ attribute where I will search:
Tried this command for a martintest2 DB..
corresponding to this ‘register’:
Making a fuzzy query: use the ~ parameter
Like what you read?
Subscribe to our newsletter and get updates on Deep Learning, NLP, Computer Vision & Python.