Question

I want to index the documents in batches. I am setting the IndexWriterConfig.setMaxBufferedDocs() to set the total number of documents in memory before they are committed back in the index.

Do I have to keep count on the document added and explicitly issue writer.commit() for the index to flush the documents in the memory or the writer will automatically take care of this?

Was it helpful?

Solution

Lucene will actually only flush documents to disk when the ram buffer size or the maximum buffered docs limit is reached (there is no auto-commit). To make them serchable, you will need to actually call IndexWriter.commit and reopen a searcher.

OTHER TIPS

Lucene does it itself, of course.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top