Skip to content

Instantly share code, notes, and snippets.

@FabianKoestring
Created December 7, 2013 18:43
Show Gist options
  • Save FabianKoestring/7846845 to your computer and use it in GitHub Desktop.
Save FabianKoestring/7846845 to your computer and use it in GitHub Desktop.
Custom implementation of the solr DefaultSimilarity class. With this no internal solr score changes will happen.
package org.apache.lucene.search.similarities;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.search.similarities.DefaultSimilarity;
public class MyNewSimilarityClass extends DefaultSimilarity {
@Override
public float coord(int overlap, int maxOverlap) {
return 1.0f;
}
@Override
public float idf(long docFreq, long numDocs) {
return 1.0f;
}
@Override
public float lengthNorm(FieldInvertState arg0) {
return 1.0f;
}
@Override
public float tf(float freq) {
return 1.0f;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment