List of usage examples for org.apache.lucene.search.uhighlight Passage setScore
public void setScore(float score)
From source file:de.unituebingen.ub.elasticsearch.TueFindCustomFieldHighlighter.java
License:Apache License
@Override protected Passage[] getSummaryPassagesNoHighlight(int maxPassages) { if (noMatchSize > 0) { int pos = 0; while (pos < fieldValue.length() && fieldValue.charAt(pos) == MULTIVAL_SEP_CHAR) { pos++;/*from ww w.j a va 2s .c om*/ } if (pos < fieldValue.length()) { int end = fieldValue.indexOf(MULTIVAL_SEP_CHAR, pos); if (end == -1) { end = fieldValue.length(); } if (noMatchSize + pos < end) { BreakIterator bi = BreakIterator.getWordInstance(breakIteratorLocale); bi.setText(fieldValue); // Finds the next word boundary **after** noMatchSize. end = bi.following(noMatchSize + pos); if (end == BreakIterator.DONE) { end = fieldValue.length(); } } Passage passage = new Passage(); passage.setScore(Float.NaN); passage.setStartOffset(pos); passage.setEndOffset(end); return new Passage[] { passage }; } } return EMPTY_PASSAGE; }