----- Original Message ----- From: "Craig Stadler" <cstadle...@hotmail.com>
To: <solr-user@lucene.apache.org>
Sent: Friday, November 04, 2011 1:39 PM
Subject: Term frequency question


I am using this reference link: http://www.mail-archive.com/solr-user@lucene.apache.org/msg26389.html

However the article is a bit old and when I try to compile the class (using newest solr 3.4 / java version "1.7.0_01" / Java(TM) SE Runtime Environment (build 1.7.0_01-b08) / Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)

I get :
-
javac -classpath /var/lib/lucene_master/lib/lucene-core-3.4.0.jar ./NoLengthNormAndTfSimilarity.java

./NoLengthNormAndTfSimilarity.java:7: error: lengthNorm(String,int) in NoLengthNormAndTfSimilarity cannot override lengthNorm(String,int) in Similarity
 public float lengthNorm(String fieldName, int numTerms) {
              ^
 overridden method is final
1 error
-
What am I doing wrong, is there a better way or newer way to do this?

The bottom line is i want the number of words to NOT factor in score, and I DO want to use related functions. I tried omitTermFreqAndPositions="true" and it did not allow me to use for example "spiderman doc"~100. Loss of all functionality

-Craig

--- actual code ---
package mypackagexyz...

import org.apache.lucene.search.DefaultSimilarity;

public class NoLengthNormAndTfSimilarity extends DefaultSimilarity {

public float lengthNorm(String fieldName, int numTerms) {
return numTerms > 0 ? 1.0f : 0.0f;
}

public float tf(float freq) {
return freq > 0 ? 1.0f : 0.0f;
}
}
---


Reply via email to