Is it possible to index documents offline in native android app using lucene?
We build it for web but looking for something which will work offline in native android apps.
sample data:
[ { "name":"abc", "desc":"ndex documents offline" }, { "name":"jjj", "desc":"index my data" } ]
I have to index my data and search from it
Analyzer code:
// Directory dir = FSDirectory.open("/libs/g");
//Analyzer analyzer = new StandardAnalyzer();
// IndexWriterConfig iwc = new IndexWriterConfig();
// Analyzer analyzer = new StandardAnalyzer();
Directory directory = new RAMDirectory();
// To store an index on disk, use this instead:
//Directory directory = FSDirectory.open("/tmp/testindex");
IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_4_10_4,new Analyzer(){
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
return null;
}
});
config.setOpenMode(OpenMode.CREATE_OR_APPEND);
indexWriter = new IndexWriter(directory, config);
//Always overwrite the directory
//iwriter.setOpenMode(OpenMode.CREATE);
//indexWriter = new IndexWriter(dir, iwc);