Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pros and cons of using Lucene's MultiSearcher class

Am using Lucene search API for a .net web application. Can I know the pros and cons of using MultiSearcher ?In what scenarios shall I use it?

Thanks for reading!

like image 763
Steve Chapman Avatar asked Oct 15 '22 15:10

Steve Chapman


1 Answers

The main drawback to MultiSearcher is that there is some overhead in merging results from multiple searchers into a single set of hits. It's similar to the penalty you experience with an unoptimized index, although likely not as severe—it depends on how many searchers are involved.

However, MultiSearcher can be very useful if you have a lot of documents, or need to do frequent updates. If you have a huge database, it allows you to split your documents into groups to be indexed on separate machines in parallel, then searched together. If you need frequent updates, you might find a MultiSearcher that has one file-system directory and one RAM directory gives you fast index updates. New documents go into the RAM directory, and periodically the contents of the RAM directory are merged into the file-system directory.

Also consider ParallelMultiSearcher. Depending on your machine architecture and query load, this could hurt or help. If you have many cores, it is likely to help, but there is additional overhead involved with the threading, so it requires some profiling under representative loads.

like image 107
erickson Avatar answered Oct 18 '22 10:10

erickson