int fieldNum = this.indexToField[pos];
double frequency = occurences / tokensPerField[fieldNum];
// is there a custom weight for this field?
String fieldName = lexicon.getFields()[fieldNum];
WeightingMethod method = lexicon.getMethod(fieldName);
if (method.equals(Parameters.WeightingMethod.BOOLEAN)) {
score = 1;
} else if (method.equals(Parameters.WeightingMethod.OCCURRENCES)) {
score = occurences;
} else if (method.equals(Parameters.WeightingMethod.FREQUENCY)) {
score = frequency;
} else if (method.equals(Parameters.WeightingMethod.TFIDF)) {
int df = lexicon.getDocFreq(indexTerm);
double idf = numdocs / (double) df;
score = frequency * Math.log(idf);
if (idf == 1)
score = frequency;