@Override protected Passage[] getEmptyHighlight(String fieldName, BreakIterator bi, int maxPassages) { boolean defaultSummary = params.getFieldBool(fieldName, HighlightParams.DEFAULT_SUMMARY, true); if (defaultSummary) { return super.getEmptyHighlight(fieldName, bi, maxPassages); } else { //TODO reuse logic of DefaultSolrHighlighter.alternateField return new Passage[0]; } }
/** * Sort the passages by *score* not by offset. */ @Override public String format(Passage passages[], String content) { Arrays.sort(passages, new Comparator<Passage>() { @Override public int compare(Passage p1, Passage p2) { return (int) (1000.0 * (p2.getScore() - p1.getScore())); } }); return super.format(passages, content); }