use of org.mycore.solr.MCRSolrCore in project mycore by MyCoRe-Org.
the class MCRSolrClassificationUtil method getCore.
/**
* Returns the solr classification core.
*/
public static MCRSolrCore getCore() {
MCRSolrCore classCore = MCRSolrClientFactory.get(CLASSIFICATION_CORE_NAME);
if (classCore == null) {
synchronized (CREATE_LOCK) {
classCore = MCRSolrClientFactory.get(CLASSIFICATION_CORE_NAME);
if (classCore == null) {
classCore = new MCRSolrCore(MCRSolrConstants.SERVER_BASE_URL, CLASSIFICATION_CORE_NAME);
MCRSolrClientFactory.add(classCore);
}
}
}
return classCore;
}
use of org.mycore.solr.MCRSolrCore in project mycore by MyCoRe-Org.
the class MCRSolrCommands method createObjectType.
@MCRCommand(syntax = "create solr objecttype {0} at {1}", help = "indexes all objects of an object type (e.g. document) on specific solr server core", order = 125)
public static void createObjectType(String type, String url) throws Exception {
MCRSolrCore core = new MCRSolrCore(url);
SolrClient concurrentSolrClient = core.getConcurrentClient();
MCRSolrIndexer.rebuildMetadataIndex(MCRXMLMetadataManager.instance().listIDsOfType(type), concurrentSolrClient);
concurrentSolrClient.optimize();
}
use of org.mycore.solr.MCRSolrCore in project mycore by MyCoRe-Org.
the class MCRSolrCommands method createIndex.
@MCRCommand(syntax = "create solr metadata and content index at {0}", help = "create solr's metadata and content index on specific solr server core", order = 120)
public static void createIndex(String url) throws Exception {
MCRSolrCore core = new MCRSolrCore(url);
SolrClient concurrentSolrClient = core.getConcurrentClient();
SolrClient solrClient = core.getClient();
MCRSolrIndexer.rebuildMetadataIndex(concurrentSolrClient);
MCRSolrIndexer.rebuildContentIndex(solrClient);
if (concurrentSolrClient instanceof ConcurrentUpdateSolrClient) {
((ConcurrentUpdateSolrClient) concurrentSolrClient).blockUntilFinished();
}
solrClient.optimize();
}
Aggregations