lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "장용석" <need4...@gmail.com>
Subject merge Index
Date Fri, 08 Aug 2008 02:12:40 GMT
hi,
I am using RamDirectory and FSDirectory for indexing documents.
I use RamDirectory as Buffer.

For example,
-----------------------------------
String indexDir = "d:/lucene_data/merge_test_index";
Analyzer analyzer  = new StopAnalyzer();

RAMDirectory ramDir    = new RAMDirectory();
IndexWriter  ramWriter = new IndexWriter(ramDir, analyzer, true);

for (int i = 0; i < 10000; i++) {
           Document doc = new Document();
           doc.add(new Field("id", "test id"+i, Field.Store.YES,
Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
            writer.addDocument(doc);
}


IndexWriter fsWriter   = new IndexWriter(indexDir, analyzer, true);
fsWriter.addIndexes(new Directory[] { ramDir });
ramWriter.close();
fsWriter.close();
------------------------------------

I know IndexWriter.addIndexes(Directory[] dir) method can merge other
indexes.

But, when I execute my program, just 2 files are created in index directory.
(segments.gen and segments_4)
And when I open with LUKE the index then meet error , It's bad index file.

What's wrong about that code..?
It's almost same as sample source code on book. I can't find any reason.

Please let me know what is wrong.

Thank you.


-- 
DEV용식
http://devyongsik.tistory.com
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message