/**
   * 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);
  }