Steve Chapman
Steve Chapman

Reputation: 1317

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!

Upvotes: 5

Views: 2663

Answers (1)

erickson
erickson

Reputation: 269817

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.

Upvotes: 4

Related Questions