All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.pageseeder.flint.solr.SolrUtils Maven / Gradle / Ivy

There is a newer version: 9.2.7
Show newest version
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;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy