org.pageseeder.flint.solr.SolrUtils Maven / Gradle / Ivy
package org.pageseeder.flint.solr;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.solr.common.SolrInputDocument;
import org.pageseeder.flint.indexing.FlintDocument;
import org.pageseeder.flint.indexing.FlintField;
public class SolrUtils {
public static Collection toDocuments(Collection docs) {
Collection sdocs = new ArrayList<>();
for (FlintDocument fdoc : docs) {
SolrInputDocument sdoc = new SolrInputDocument();
for (FlintField field : fdoc.fields()) {
sdoc.addField(field.name(), field.value(), field.boost());
}
sdocs.add(sdoc);
}
return sdocs;
}
}