This project is no longer active. See its descendant if you are looking for Cassandra implementation of Lucene's Directory
Cassandra implementation of Lucene Directory.
By Thanh Ba Nguyen (btnguyen2k (at) gmail.com)
Project home: https://github.com/DDTH/cassdir
- Store Lucene's index in Cassandra.
- Performance enhancement with caching support.
- Support fine-tuning Cassandra consistency level per operation (read/write file data, lock, remove file, etc).
Latest release version: 0.1.1
. See RELEASE-NOTES.md.
Maven dependency:
<dependency>
<groupId>com.github.ddth</groupId>
<artifactId>cassdir</artifactId>
<version>0.1.1</version>
</dependency>
- ddth-cache-adapter: for caching support.
- ddth-redis: to use Redis as cache backend.
- ddth-cql-utils: library to interact with Cassandra via CQL.
- Datastax Java Driver for Cassandra: Java driver to access Cassandra cluster.
Cassandra column family schema (as CQL): see dbschema/cassdir.cql.
Create a CassandraDirectory
instance:
String cassHostsAndPorts = "localhost:9042,host2:port2,host3:port3";
CassandraDirectory DIR = new CassandraDirectory(cassHostsAndPorts, cassUser, cassPassword, cassKeySpace);
DIR.init();
Index documents with IndexWriter
:
Analyzer analyzer = new StandardAnalyzer();
IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
IndexWriter iw = new IndexWriter(DIR, iwc);
// add/update documents
// ...
iw.commit();
iw.close();
Or, search documents with IndexSearcher
:
IndexReader ir = DirectoryReader.open(DIR);
IndexSearcher is = new IndexSearcher(ir);
// search documents
// ...
ir.close();
Call CassandraDirectory.destroy()
when done.
Examples: see src/test/java.
See LICENSE.txt for details. Copyright (c) 2015 Thanh Ba Nguyen.
Third party libraries are distributed under their own license(s).