for (SolrDocument sd : sdl)
{
i++;
System.out.println("Processed access #" + i + " of "
+ sdl.getNumFound());
SolrInputDocument sdi = ClientUtils.toSolrInputDocument(sd);
Integer id = (Integer) sd.getFieldValue("id");
Integer type = (Integer) sd.getFieldValue("type");
DSpaceObject dso = DSpaceObject.find(context, type, id);
// Do any additional indexing, depends on the plugins
List<SolrStatsIndexPlugin> solrServiceIndexPlugins = new DSpace()
.getServiceManager().getServicesByType(
SolrStatsIndexPlugin.class);
for (SolrStatsIndexPlugin solrServiceIndexPlugin : solrServiceIndexPlugins)
{
solrServiceIndexPlugin.additionalIndex(null, dso,
sdi);
}
context.removeCached(dso, id);
solr.add(sdi);
}
solr.commit();
solr.optimize();
sdl = indexer.getRawData(CrisConstants.RP_TYPE_ID);
System.out.println("Found " + sdl.getNumFound()
+ " access in the RP statistics core");
HttpSolrServer rpsolr = indexer.getSolr();
indexer.deleteByType(CrisConstants.RP_TYPE_ID);
rpsolr.commit();
System.out.println("Remove old data");
ApplicationService as = dspace.getServiceManager().getServiceByName(
"applicationService", ApplicationService.class);
i = 0;
for (SolrDocument sd : sdl)
{
i++;
System.out.println("Processed RP access #" + i + " of "
+ sdl.getNumFound());
SolrInputDocument sdi = ClientUtils.toSolrInputDocument(sd);
Integer id = (Integer) sd.getFieldValue("id");
ResearcherPage rp = as.get(ResearcherPage.class, id);
if (rp == null)
continue;