public Object highlightFieldForDoc(IndexReader reader,int docId,String content) throws IOException {
  if (content.length() == 0) {
    return null;
  }
  breakIterator.setText(content);
  List<OffsetsEnum> offsetsEnums=fieldOffsetStrategy.getOffsetsEnums(reader,docId,content);
  Passage[] passages;
  try {
    passages=highlightOffsetsEnums(offsetsEnums);
  }
  finally {
    IOUtils.close(offsetsEnums);
  }
  if (passages.length == 0) {
    passages=getSummaryPassagesNoHighlight(maxNoHighlightPassages == -1 ? maxPassages : maxNoHighlightPassages);
  }
  if (passages.length > 0) {
    return passageFormatter.format(passages,content);
  }
 else {
    return null;
  }
}

public Object highlightFieldForDoc ( IndexReader reader , int docId , String content ) throws IOException { if ( content . length ( ) == 0 ) { return null ; } breakIterator . setText ( content ) ; List < OffsetsEnum > offsetsEnums = fieldOffsetStrategy . getOffsetsEnums ( reader , docId , content ) ; Passage [ ] passages ; try { passages = highlightOffsetsEnums ( offsetsEnums ) ; } finally { IOUtils . close ( offsetsEnums ) ; } if ( passages . length == 0 ) { passages = getSummaryPassagesNoHighlight ( maxNoHighlightPassages == - 1 ? maxPassages : maxNoHighlightPassages ) ; } if ( passages . length > 0 ) { return passageFormatter . format ( passages , content ) ; } else { return null ; } }
the primary method - - highlight this doc , assuming a specific field and given this content .
