In our project, we reuse Analyzer and enter it with a predefined Version in IndexWriter and IndexReader . It is recommended that Analyzer be the same when indexing and when searching, so at least the template is applied to it.
Since the last two are wrappers for actually accessing the Lucene index, you will need to create an index stream every time you use them, and it would make little sense to reuse them since they will block simultaneous calls (both read and write s).
There are several “best practices” and templates in this project that you can use.
source share