WeightedTerm[] termsArray = new WeightedTerm[terms.size()];
for (int i=0; i < terms.size(); i++) {
WeightedTerm term = (WeightedTerm) terms.get(i);
termsArray[i] = term;
}
QueryTermScorer scorer = new QueryTermScorer(termsArray);
// create highlighter
Highlighter highlighter = new Highlighter(formatter, scorer);
return highlighter;