This project is no longer active. See its descendant if you are looking for Redis implementation of Lucene's Directory
Redis implementation of Lucene Directory.
By Thanh Ba Nguyen (btnguyen2k (at) gmail.com)
Project home: https://github.com/DDTH/redir
Latest release version: 0.1.2
. See RELEASE-NOTES.md.
Maven dependency:
<dependency>
<groupId>com.github.ddth</groupId>
<artifactId>redir</artifactId>
<version>0.1.2</version>
</dependency>
- jedis: the underlying lib to access Redis.
Create a RedisDirectory
instance:
RedisDirectory DIR = new RedisDirectory(redisHost, redisPort, redisPassword);
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 RedisDirectory.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).