Skip to content

Latest commit

 

History

History
88 lines (58 loc) · 2.39 KB

README.md

File metadata and controls

88 lines (58 loc) · 2.39 KB

This project is no longer active. See its descendant if you are looking for Cassandra implementation of Lucene's Directory

cassdir

Cassandra implementation of Lucene Directory.

By Thanh Ba Nguyen (btnguyen2k (at) gmail.com)

Project home: https://github.com/DDTH/cassdir

Features

  • 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).

Installation

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>

Related projects/libs

Usage

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.

License

See LICENSE.txt for details. Copyright (c) 2015 Thanh Ba Nguyen.

Third party libraries are distributed under their own license(s).