When using Lucene to build an index, there is a memory overflow due to the large size of the IndexWriter object.

when using Lucene to build an index, the IndexWriter object is too large to lead to memory overflow, but my IndexWriter has been created by declaring temporary variables, but after each execution of the IndexWriter.addDocument () method, the size of the object will accumulate on the size of the previously established index, and because of the large amount of data, the IndexWriter object is getting bigger and bigger.


IndexWriter has a commit method to submit and empty cached data.

Menu