Search in sources :

Example 1 with MCRSolrCore

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;
}
Also used : MCRSolrCore(org.mycore.solr.MCRSolrCore)

Example 2 with MCRSolrCore

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();
}
Also used : SolrClient(org.apache.solr.client.solrj.SolrClient) ConcurrentUpdateSolrClient(org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient) MCRSolrCore(org.mycore.solr.MCRSolrCore) MCRCommand(org.mycore.frontend.cli.annotation.MCRCommand)

Example 3 with MCRSolrCore

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();
}
Also used : SolrClient(org.apache.solr.client.solrj.SolrClient) ConcurrentUpdateSolrClient(org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient) MCRSolrCore(org.mycore.solr.MCRSolrCore) ConcurrentUpdateSolrClient(org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient) MCRCommand(org.mycore.frontend.cli.annotation.MCRCommand)

Aggregations

MCRSolrCore (org.mycore.solr.MCRSolrCore)3 SolrClient (org.apache.solr.client.solrj.SolrClient)2 ConcurrentUpdateSolrClient (org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient)2 MCRCommand (org.mycore.frontend.cli.annotation.MCRCommand)2