code: public String getExcerpt(String id, int maxFragments, int maxFragmentSize) throws IOException
     {
        IndexReader reader = index.getIndexReader();
        try
        {
           checkRewritten(reader);
           Term idTerm = new Term(FieldNames.UUID, id);
           TermDocs tDocs = reader.termDocs(idTerm);
           int docNumber;
           Document doc;
           try
           {
              if (tDocs.next())
              {
                 docNumber = tDocs.doc();
                 doc = reader.document(docNumber);
              }
              else
              {
                 // node not found in index
                 return null;
              }
           }
           finally
           {
              tDocs.close();
           }
           Fieldable[] fields = doc.getFieldables(FieldNames.FULLTEXT);
  
           if (fields == null)
           {
              LOG.debug("Fulltext field not stored, using {}", SimpleExcerptProvider.class.getName());
              SimpleExcerptProvider exProvider = new SimpleExcerptProvider();
              exProvider.init(query, index);
              return exProvider.getExcerpt(id, maxFragments, maxFragmentSize);
           }
           StringBuilder text = new StringBuilder();
           String separator = "";
           for (int i = 0; i < fields.length; i++)
           {
              if (fields[i].stringValue().length() > 0)
              {
                 text.append(separator);
                 text.append(fields[i].stringValue());
                 separator = " ";
              }
  
           }
           TermFreqVector tfv = reader.getTermFreqVector(docNumber, FieldNames.FULLTEXT);
           if (tfv instanceof TermPositionVector)
           {
              return createExcerpt((TermPositionVector)tfv, text.toString(), maxFragments, maxFragmentSize);
           }
           else
           {
              LOG.debug("No TermPositionVector on Fulltext field.");
              return null;
           }
        }
        finally
        {
           Util.closeOrRelease(reader);
        }
     }
docs: {@inheritDoc}