Writing a utility in java to do a copy from one solr index to another.
I query for the documents I want to copy:

SolrQuery q = new SolrQuery();
q.setQuery("dogs");
QueryResponse rq = source_solrserver.query(q);
for( SolrDocument d : rq.getResults() ) {
        // now I want to add these to a new server after modifying it slightly
        d.addField("newField", "somedata");
        dest_solrserver.add(d);
}

but that doesn't work-- add wants a SolrInputDocument, not a SolrDocument. I can't cast or otherwise easily create the former from the latter. How could I do this sort of thing?




Reply via email to