lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: PerFieldSimilarity
Date Wed, 04 May 2005 21:09:59 GMT
Robichaud, Jean-Philippe wrote:
> How cool, I did not knew that...  that may help me...  If I understand you
> correctly, I can create a boolean query where each "clause" use a different
> similarity ?

Yes.  That would look something like:

BooleanQuery booleanQuery = new BooleanQuery();
TermQuery clause1 = new TermQuery("foo", "bar") {
     public Similarity getSimilarity(Searcher searcher) {
       return new DefaultSimilarity() {
         public float idf(Term term) { return 1.0f; }
       };
     }
  };
booleanQuery.add(clause1, true, false);
...

Doug


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message