简体   繁体   中英

Batch Commit for Lucene Index

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?

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.

当然,Lucene会自己做。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM