@Override @SuppressWarnings("unchecked") public NamedList<Object> doHighlighting(DocList docs,Query query,SolrQueryRequest req,String[] defaultFields) throws IOException {
  SolrParams params=req.getParams();
  if (!isHighlightingEnabled(params))   return null;
  SolrIndexSearcher searcher=req.getSearcher();
  IndexSchema schema=searcher.getSchema();
  NamedList fragments=new SimpleOrderedMap();
  String[] fieldNames=getHighlightFields(query,req,defaultFields);
  Set<String> fset=new HashSet<>();
{
    for (    String f : fieldNames) {
      fset.add(f);
    }
    SchemaField keyField=schema.getUniqueKeyField();
    if (null != keyField)     fset.add(keyField.getName());
  }
  FastVectorHighlighter fvh=new FastVectorHighlighter(params.getBool(HighlightParams.USE_PHRASE_HIGHLIGHTER,true),params.getBool(HighlightParams.FIELD_MATCH,false));
  fvh.setPhraseLimit(params.getInt(HighlightParams.PHRASE_LIMIT,SolrHighlighter.DEFAULT_PHRASE_LIMIT));
  FieldQuery fieldQuery=fvh.getFieldQuery(query,searcher.getIndexReader());
  DocIterator iterator=docs.iterator();
  for (int i=0; i < docs.size(); i++) {
    int docId=iterator.nextDoc();
    Document doc=searcher.doc(docId,fset);
    NamedList docSummaries=new SimpleOrderedMap();
    for (    String fieldName : fieldNames) {
      fieldName=fieldName.trim();
      if (useFastVectorHighlighter(params,schema,fieldName))       doHighlightingByFastVectorHighlighter(fvh,fieldQuery,req,docSummaries,docId,doc,fieldName);
 else       doHighlightingByHighlighter(query,req,docSummaries,docId,doc,fieldName);
    }
    String printId=schema.printableUniqueKey(doc);
    fragments.add(printId == null ? null : printId,docSummaries);
  }
  return fragments;
}

@ Override @ SuppressWarnings ( "unchecked" ) public NamedList < Object > doHighlighting ( DocList docs , Query query , SolrQueryRequest req , String [ ] defaultFields ) throws IOException { SolrParams params = req . getParams ( ) ; if ( ! isHighlightingEnabled ( params ) ) return null ; SolrIndexSearcher searcher = req . getSearcher ( ) ; IndexSchema schema = searcher . getSchema ( ) ; NamedList fragments = new SimpleOrderedMap ( ) ; String [ ] fieldNames = getHighlightFields ( query , req , defaultFields ) ; Set < String > fset = new HashSet < > ( ) ; { for ( String f : fieldNames ) { fset . add ( f ) ; } SchemaField keyField = schema . getUniqueKeyField ( ) ; if ( null != keyField ) fset . add ( keyField . getName ( ) ) ; } FastVectorHighlighter fvh = new FastVectorHighlighter ( params . getBool ( HighlightParams . USE_PHRASE_HIGHLIGHTER , true ) , params . getBool ( HighlightParams . FIELD_MATCH , false ) ) ; fvh . setPhraseLimit ( params . getInt ( HighlightParams . PHRASE_LIMIT , SolrHighlighter . DEFAULT_PHRASE_LIMIT ) ) ; FieldQuery fieldQuery = fvh . getFieldQuery ( query , searcher . getIndexReader ( ) ) ; DocIterator iterator = docs . iterator ( ) ; for ( int i = 0 ; i < docs . size ( ) ; i ++ ) { int docId = iterator . nextDoc ( ) ; Document doc = searcher . doc ( docId , fset ) ; NamedList docSummaries = new SimpleOrderedMap ( ) ; for ( String fieldName : fieldNames ) { fieldName = fieldName . trim ( ) ; if ( useFastVectorHighlighter ( params , schema , fieldName ) ) doHighlightingByFastVectorHighlighter ( fvh , fieldQuery , req , docSummaries , docId , doc , fieldName ) ; else doHighlightingByHighlighter ( query , req , docSummaries , docId , doc , fieldName ) ; } String printId = schema . printableUniqueKey ( doc ) ; fragments . add ( printId == null ? null : printId , docSummaries ) ; } return fragments ; }
generates a list of highlighted query fragments for each item in a list of documents , or returns null if highlighting is disabled .
