lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saisantoshi <saisantosh...@gmail.com>
Subject IndexWriterConfig.OpenMode.CREATE vs OpenMode.APPEND (index files)
Date Thu, 31 Jan 2013 18:39:37 GMT
I am using the following below for creating the IndexWriter (for my
indexing):

IndexWriterConfig indexWriterConfig = new
IndexWriterConfig(Version.LUCENE_40,
                new LimitTokenCountAnalyzer(analyzer,
MAX_FIELD_SCAN_LENGTH));
        
if (create) {  // create will be trure for indexing first time and later
will be false for updating the existing index
                indexWriterConfig.setOpenMode(OpenMode.CREATE);
        } else {
            indexWriterConfig.setOpenMode(OpenMode.APPEND);
  }
        TieredMergePolicy mergePolicy = new TieredMergePolicy();
        indexWriterConfig.setMergePolicy(mergePolicy.setNoCFSRatio(1.0d));
         IndexWriter indexWriter = new IndexWriter(directory,
indexWriterConfig);

For creating the first time, index it is creating the following files:

_0.cfe
_0.cfs
_0.csi
segments.gen
segments_1

on subsequent updates, it is creating additional files like the below:

_0.cfe
_0.cfs
_0.csi
_1.cfe
_1.cfs
_1.csi
_0_1.del
_2.cfe
_2.cfs
_2.csi
segments.gen
segments_3

I am assuming that it should override the files initially created for
indexing:

should have just the following below files:

_2.cfe
_2.cfs
_2.csi
segments.gen
segments_3

Can someone please let me know if this is intended behavior or something
wrong with the way I am creating the IndexWriterConfig.

Appreciate if you could shed some light on this as the docs are not very
clear.

Thanks,
Sai.








--
View this message in context: http://lucene.472066.n3.nabble.com/IndexWriterConfig-OpenMode-CREATE-vs-OpenMode-APPEND-index-files-tp4037766.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
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