Searcher is quite light. It is the index reader that is heavier. So create a single index reader, for each of the similarities to be use concurrently, create a searcher over that single reader, set its similarity, and so on.
Doron On Mon, Apr 27, 2009 at 7:53 PM, Rakesh Sinha <rakesh.use...@gmail.com>wrote: > I am looking into setting custom scoring sing Similarity > (org.apache.lucene.search.Similarity) . Searcher has a method to set > similarity as follows - searcher.setSimilarity(Similarity) and > retrieve the same too. I am looking at a case where I can have just > one Searcher instance and use different similarities for different > queries (since searcher is multi-threaded ). > > results = searcher.search( similarity, "myfield:mysearchstring" ); > > and be ensured that the right similarity is applied for the right > fields to be searched for. Right now - it would go along the lines of > searcher.setSimilarity(Similarity) and then followed by the > searcher.search ( .. ) so I cannot do concurrent searches (unless they > are on different searcher instances altogether). Any suggestions > regarding this ? Thanks. >