Class MCRSolrCommands

java.lang.Object
org.mycore.frontend.cli.MCRAbstractCommands
org.mycore.solr.commands.MCRSolrCommands
All Implemented Interfaces:
MCRExternalCommandInterface

@MCRCommandGroup(name="SOLR Commands") public class MCRSolrCommands extends MCRAbstractCommands
Class provides useful solr related commands.
Author:
shermann, Sebastian Hofmann
  • Constructor Details

    • MCRSolrCommands

      public MCRSolrCommands()
  • Method Details

    • listConfig

      @MCRCommand(syntax="show solr configuration", help="displays MyCoRe properties for the current Solr configuration", order=10) public static void listConfig()
      This command displays the MyCoRe properties, which have to be set, to reload the current Solr / Solr Core configuration on the next start of the MyCoRe application.
    • registerSolrCore

      @MCRCommand(syntax="register solr core with name {0} on server {1} as core {2}", help="registers a Solr core within MyCoRe", order=40) public static void registerSolrCore(String coreName, String server, String coreID)
    • registerSolrCore

      @MCRCommand(syntax="register solr core with name {0} as core {1}", help="registers a Solr core on the configured default Solr server within MyCoRe", order=50) public static void registerSolrCore(String coreName, String coreID)
    • switchSolrCore

      @MCRCommand(syntax="switch solr core {0} with core {1}", help="switches between two Solr core configurations", order=60) public static void switchSolrCore(String coreID1, String coreID2)
    • reloadSolrConfiguration

      @MCRCommand(syntax="reload solr configuration {0} in core {1}", help="reloads the schema and the configuration in Solr by using the Solr schema api for core with the id {0}", order=70) public static void reloadSolrConfiguration(String configType, String coreID)
      This command recreates the managed-schema.xml and solrconfig.xml files. First it removes all schema definitions, except for some MyCoRe default types and fields. Second it parses the available MyCoRe modules and components and adds / updates / deletes the schema definition. Finally it does the same for the solrconfig.xml definition. see https://github.com/MyCoRe-Org/mycore_solr_configset_main
      Parameters:
      coreID - the core type of the core that should be reloaded; the MyCoRe default application coreID is main
    • rebuildMetadataAndContentIndex

      @MCRCommand(syntax="rebuild solr metadata and content index in core {0}", help="rebuilds metadata and content index in Solr for core with the id {0}", order=110) public static void rebuildMetadataAndContentIndex(String coreID) throws Exception
      Throws:
      Exception
    • rebuildMetadataIndexType

      @MCRCommand(syntax="rebuild solr metadata index for all objects of type {0} in core {1}", help="rebuilds the metadata index in Solr for all objects of type {0} in core with the id {1}", order=130) public static void rebuildMetadataIndexType(String type, String coreID) throws Exception
      Throws:
      Exception
    • rebuildMetadataIndexObject

      @MCRCommand(syntax="rebuild solr metadata index for object {0} in core {1}", help="rebuilds metadata index in Solr for the given object in core with the id {1}", order=120) public static void rebuildMetadataIndexObject(String object, String coreID) throws Exception
      Throws:
      Exception
    • rebuildMetadataIndexForSelected

      @MCRCommand(syntax="rebuild solr metadata index for selected in core {0}", help="rebuilds content index in Solr for selected objects and or derivates in core with the id {0}", order=140) public static void rebuildMetadataIndexForSelected(String coreID)
    • rebuildMetadataIndex

      @MCRCommand(syntax="rebuild solr metadata index in core {0}", help="rebuilds metadata index in Solr in core with the id {0}", order=150) public static void rebuildMetadataIndex(String coreID)
    • rebuildContentIndexObject

      @MCRCommand(syntax="rebuild solr content index for object {0} in core {1}", help="rebuilds content index in Solr for the all derivates of object with the id {0} in core with the id {1}", order=160) public static void rebuildContentIndexObject(String objectID, String coreID)
    • rebuildContentIndexForSelected

      @MCRCommand(syntax="rebuild solr content index for selected in core {0}", help="rebuilds content index in Solr for alll derivates of selected objects in core with the id {0}", order=170) public static void rebuildContentIndexForSelected(String coreID)
    • rebuildContentIndex

      @MCRCommand(syntax="rebuild solr content index in core {0}", help="rebuilds content index in Solr in core with the id {0}", order=180) public static void rebuildContentIndex(String coreID)
    • rebuildClassificationIndex

      @MCRCommand(syntax="rebuild solr classification index in core {0}", help="rebuilds classification index in Solr in the core with the id {0}", order=190) public static void rebuildClassificationIndex(String coreID)
    • dropIndex

      @MCRCommand(syntax="clear solr index in core {0}", help="deletes all entries from index in Solr in core with the id {0}", order=210) public static void dropIndex(String coreID) throws Exception
      Throws:
      Exception
    • dropIndexByType

      @MCRCommand(syntax="delete from solr index all objects of type {0} in core {1}", help="deletes all objects of type {0} from index in Solr in core with the id {1}", order=220) public static void dropIndexByType(String type, String coreID) throws Exception
      Throws:
      Exception
    • deleteByIdFromSolr

      @MCRCommand(syntax="delete from solr index object {0} in core {1}", help="deletes an object with id {0} from index in Solr in core with the id {1}", order=230) public static void deleteByIdFromSolr(String objectID, String coreID)
    • selectObjectsWithSolrQuery

      @MCRCommand(syntax="select objects with solr query {0} in core {1}", help="selects mcr objects with a solr query {0} in core with the id {1}", order=310) public static void selectObjectsWithSolrQuery(String query, String coreID) throws Exception
      Throws:
      Exception
    • optimize

      @MCRCommand(syntax="optimize solr index in core {0}", help="optimizes the index in Solr in core with the id {0}. The operation works like a hard commit and forces all of the index segments to be merged into a single segment first. Depending on the use cases, this operation should be performed infrequently (e.g. nightly), since it is very expensive and involves reading and re-writing the entire index", order=410) public static void optimize(String coreID)
      This command optimizes the index in Solr in a given core. The operation works like a hard commit and forces all of the index segments to be merged into a single segment first. Depending on the use cases, this operation should be performed infrequently (e.g. nightly) since it is very expensive and involves reading and re-writing the entire index.
    • synchronizeMetadataIndex

      @MCRCommand(syntax="synchronize solr metadata index for all objects of type {0} in core {1}", help="synchronizes the MyCoRe store and index in Solr in core with the id {1} for objects of type {0}", order=420) public static void synchronizeMetadataIndex(String objectType, String coreID) throws Exception
      Throws:
      Exception
    • synchronizeMetadataIndex

      @MCRCommand(syntax="synchronize solr metadata index in core {0}", help="synchronizes the MyCoRe store and index in Solr in core with the id {0}", order=430) public static void synchronizeMetadataIndex(String coreID) throws Exception
      Throws:
      Exception