@Override
 public void populate(List<IndexDocumentResult> indexDocuments)
     throws IOException, SearchLibException {
   SchemaFieldList schemaFieldList = request.getConfig().getSchema().getFieldList();
   for (int docId : docArray) {
     IndexDocumentResult indexDocument = new IndexDocumentResult(schemaFieldList.size());
     Map<String, FieldValue> storedFieldMap = reader.getDocumentStoredField(docId);
     for (SchemaField schemaField : schemaFieldList) {
       String fieldName = schemaField.getName();
       List<IndexTerm> indexTermList = null;
       if (schemaField.checkIndexed(Indexed.YES)) {
         if (schemaField.getTermVector() == TermVector.NO) {
           indexTermList = IndexTerm.toList(reader, fieldName, docId);
         } else {
           TermFreqVector termFreqVector = reader.getTermFreqVector(docId, fieldName);
           indexTermList = IndexTerm.toList(termFreqVector);
         }
       }
       IndexField indexField =
           new IndexField(fieldName, storedFieldMap.get(fieldName), indexTermList);
       indexDocument.add(indexField);
     }
     indexDocuments.add(indexDocument);
   }
 }
  /**
   * Retourne la liste des champs "snippet".
   *
   * @param node
   * @param source
   * @param target
   * @throws IllegalAccessException
   * @throws InstantiationException
   */
  public static void copySnippetFields(Node node, SchemaFieldList source, SnippetFieldList target)
      throws InstantiationException, IllegalAccessException {
    String fieldName = XPathParser.getAttributeString(node, "name");
    String tag = XPathParser.getAttributeString(node, "tag");
    if (tag == null) tag = "em";
    int maxSnippetNumber = XPathParser.getAttributeValue(node, "maxSnippetNumber");
    if (maxSnippetNumber == 0) maxSnippetNumber = 1;
    int maxSnippetSize = XPathParser.getAttributeValue(node, "maxSnippetSize");
    if (maxSnippetSize == 0) maxSnippetSize = 200;
    int timeLimit = DomUtils.getAttributeInteger(node, "timeLimit", 0);

    FragmenterAbstract fragmenter =
        FragmenterAbstract.newInstance(XPathParser.getAttributeString(node, "fragmenterClass"));
    fragmenter.setAttributes(node.getAttributes());
    String separator = XPathParser.getAttributeString(node, "separator");
    if (separator == null) separator = "...";
    SchemaField schemaField = source.get(fieldName);
    if (schemaField == null) return;
    SnippetField field =
        new SnippetField(
            schemaField.getName(),
            tag,
            separator,
            maxSnippetSize,
            maxSnippetNumber,
            fragmenter,
            timeLimit);
    target.put(field);
  }