[solr ] solr自定义Similarity问题

自定义了一个similarity,仿照classicsimilarity写的,代码如下
public class CustomSimilarity extends TFIDFSimilarity{

@Override
public float coord(int overlap, int maxOverlap) {
return  1/ (float)maxOverlap;
}

@Override
public float decodeNormValue(long arg0) {
return 1;
}

@Override
public long encodeNormValue(float arg0) {
return 1;
}

@Override
public float idf(long docFreq, long numDocs) {
return 1;
}

@Override
public float lengthNorm(FieldInvertState state) {
final int numTerms;
    if (discountOverlaps)
      numTerms = state.getLength() - state.getNumOverlap();
    else
      numTerms = state.getLength();
    return state.getBoost() * ((float) (1.0 / Math.sqrt(numTerms)));
}

@Override
public float queryNorm(float sumOfSquaredWeights) {
return 1;
}

@Override
public float scorePayload(int doc, int start, int end, BytesRef payload) {
return 1;
}

@Override
public float sloppyFreq(int distance) {
return 1;
}

@Override
public float tf(float freq) {
return 1;
}

  protected boolean discountOverlaps = true;



  public void setDiscountOverlaps(boolean v) {
    discountOverlaps = v;
  }

  /**
   * Returns true if overlap tokens are discounted from the document's length.
   * @see #setDiscountOverlaps
   */
  public boolean getDiscountOverlaps() {
    return discountOverlaps;
  }

  @Override
  public String toString() {
    return "CustomSimilarity";
  }

}
但是lengthNorm()方法一直没有被调用(无论怎么改都不影响得分),请问各位大神什么原因呀?
Global site tag (gtag.js) - Google Analytics