lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doron Cohen <cdor...@gmail.com>
Subject Re: Searcher#setSimilarity clarifications
Date Tue, 28 Apr 2009 14:30:58 GMT
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.usenet@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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message