use of org.mycore.solr.index.handlers.stream.MCRSolrFilesIndexHandler in project mycore by MyCoRe-Org.
the class MCRSolrIndexer method rebuildContentIndex.
/**
* Rebuilds solr's content index.
*
* @param solrClient
* solr client connection
* @param list
* list of mycore object id's
* @param priority
* higher priority means earlier execution
*/
public static void rebuildContentIndex(SolrClient solrClient, List<String> list, int priority) {
LOGGER.info("Re-building Content Index");
if (list.isEmpty()) {
LOGGER.info("No objects to index");
return;
}
long tStart = System.currentTimeMillis();
int totalCount = list.size();
LOGGER.info("Sending content of {} derivates to solr for reindexing", totalCount);
for (String id : list) {
MCRSolrFilesIndexHandler indexHandler = new MCRSolrFilesIndexHandler(id, solrClient);
indexHandler.setCommitWithin(BATCH_AUTO_COMMIT_WITHIN_MS);
submitIndexHandler(indexHandler, priority);
}
long tStop = System.currentTimeMillis();
MCRSolrIndexStatisticCollector.FILE_TRANSFER.addTime(tStop - tStart);
}
use of org.mycore.solr.index.handlers.stream.MCRSolrFilesIndexHandler in project mycore by MyCoRe-Org.
the class MCRSolrPathDocumentFactory method getDocument.
/**
* Generates a {@link SolrInputDocument} from a {@link MCRPath} instance.
*
* @see MCRSolrFileIndexHandler
* @see MCRSolrFilesIndexHandler
* @see MCRSolrIndexHandlerFactory
*/
public SolrInputDocument getDocument(Path input, BasicFileAttributes attr) throws IOException, MCRPersistenceException {
SolrInputDocument doc = new SolrInputDocument();
Consumer<? super MCRSolrFileIndexAccumulator> accumulate = (accumulator) -> {
LOGGER.debug("{} accumulates {}", accumulator, input);
try {
accumulator.accumulate(doc, input, attr);
} catch (IOException e) {
LOGGER.error("Error in Accumulator!", e);
}
};
ACCUMULATOR_LIST.forEach(accumulate);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("MCRFile {} transformed to:\n{}", input, doc);
}
return doc;
}
Aggregations