I’m using Lucene search API in a web based application.
Which method of Lucene’s IndexSearcher class is recommended to use?Is any method faster than other?
1.IndexSearcher(Directory directory)
2.IndexSearcher(IndexReader r)
3.IndexSearcher(String path)
Thanks for reading.
The constructor which accepts Directory and path to index internally use the constructor that accpets IndexReader. So, there is no performance advantage of one over others. Keep in mind that if you create searcher with IndexReader, you have to close the reader explicitly after you close the searcher.