lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject customizing the termFrequency
Date Mon, 23 May 2005 15:45:39 GMT
Hi fellows,
I'm trying to customize lucene to meet my needs.
In my domain, I need that whenever a term appears more than once in a field,
I want to count it as one occurrence (e.g. tf = signum(frequency) ).
I was trying to inherit DefaultSimilarity and override tf, but it didn't
More over, I added a printing of the freq tf() receives as an argument, and
no matter what I'm searching for, it is called exactly 32(??) times with the
values of 0...31.
class MySimilarity extends DefaultSimilarity {
 public float tf(float freq)  {
  System.out.println( "freq="+freq );
  return NumberUtils.sign( freq ) ;
Of course I'm using at the beging of my code   
Similarity.setDefault( new MySimilarity() );
Any idea?
 <> www.FetchBook.Info
Find the lowest price - Compare more then a hundred book stores in a click.

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