lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yakob <jacob...@opensuse-id.org>
Subject Re: integrating RAMDirectory in FSDirectory
Date Sat, 16 Oct 2010 16:47:36 GMT
On 10/13/10, Erick Erickson <erickerickson@gmail.com> wrote:
> Try IndexWrite.addIndexes. I confess that I haven't used that since
> 2.4, but I suspect it's what you want.
>

ok after I started asking around in stackoverflow regarding this
problem. someone was kind enough to give an answer. well sort of.

private int index(File indexDir, File dataDir, String suffix) throws Exception {
    RAMDirectory ramDir = new RAMDirectory();          // 1
    IndexWriter indexWriter = new IndexWriter(
            ramDir,                                    // 2
            new SimpleAnalyzer(),
            true,
            IndexWriter.MaxFieldLength.LIMITED);
    indexWriter.setUseCompoundFile(false);
    indexDirectory(indexWriter, dataDir, suffix);
    int numIndexed = indexWriter.maxDoc();
    indexWriter.optimize();
    indexWriter.close();

    Directory.copy(ramDir, FSDirectory.open(indexDir)); // 3

    return numIndexed;
}

what I am asking now is that the last line.

Directory.copy(ramDir, FSDirectory.open(indexDir)); // 3

the above line is wrong when I try to compile it, as lucene didn't
reserve any keyword "copy" in its class. so is there any workaround
this problem? what's the best solution to copy directory from
RAMDirectory to FSDirectory besides using copy? thanks.

http://stackoverflow.com/questions/3913180/how-to-integrate-ramdirectory-into-fsdirectory-in-lucene/3923914#3923914
-- 
http://jacobian.web.id

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message