@Override
 public void document(Document document) {
   for (Field field : document.getFields()) {
     for (String value : field.getValues()) {
       field(field.getName(), value);
     }
   }
 }
示例#2
0
  @Override
  public void document(Document document) {
    Map<String, String> documentMap = new HashMap<String, String>();
    for (Field field : document.getFields()) {
      documentMap.put(field.getName(), field.getValue());
    }

    StrSubstitutor sub = new StrSubstitutor(documentMap);
    String value = sub.replace(output);

    document.addField(outputField, value);

    super.document(document);
  }
示例#3
0
  @Override
  public void document(Document document) {
    SolrInputDocument inputDoc = new SolrInputDocument();
    for (Field field : document.getFields()) {
      if (!isFieldIgnored(field.getName())) {
        inputDoc.addField(field.getName(), field.getValues());
      }
    }

    try {
      server.add(inputDoc);
    } catch (SolrServerException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    super.document(document);
  }