lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: SweetSpotSimiliarity
Date Wed, 24 May 2006 17:46:32 GMT
Chris Hostetter wrote:
> Alas ... tf() doesn't take in a field name, to do this, you'd have to
> override the Similarity each time your construct a query object,
> something like this i believe...
> 
>    Query q = new TermQuery(t) {
>       public Similarity getSimilarity(Searcher s) {
>          return new SimilarityDelegator
>             (TermQuery.this.super.getSimilarity(s)) {
>                public float tf(freq) {
>                  ...
>                }
>             }
>          }
>       }
>    }
> 
> ...but good lord if that isn't a pain.

There's no reason you have to copy this everywhere.  You could use a 
regular, non-anonymous subclass of TermQuery and use that everywhere, 
no?  QueryParser should probably have a getTermQuery() method that can 
be overridden to support this kind of thing...

Doug

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


Mime
View raw message