Java 类org.apache.lucene.search.postingshighlight.Passage 实例源码

项目:search    文件:PostingsSolrHighlighter.java   
@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];
  }
}
项目:ifpress-solr-plugin    文件:HighlightFormatter.java   
/**
 * 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);
}
项目:read-open-source-code    文件:PostingsSolrHighlighter.java   
@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];
  }
}