Class MCRSolrClassificationUtil

java.lang.Object
org.mycore.solr.classification.MCRSolrClassificationUtil

public abstract class MCRSolrClassificationUtil extends Object
Some solr classification utility stuff.
Author:
Matthias Eichner
  • Constructor Details

    • MCRSolrClassificationUtil

      public MCRSolrClassificationUtil()
  • Method Details

    • rebuildIndex

      public static void rebuildIndex()
      Reindex the whole classification system with the default classification solr core.
    • rebuildIndex

      public static void rebuildIndex(org.apache.solr.client.solrj.SolrClient client)
      Reindex the whole classification system.
      Parameters:
      client - the target solr client
    • bulkIndex

      public static void bulkIndex(org.apache.solr.client.solrj.SolrClient client, List<org.apache.solr.common.SolrInputDocument> solrDocumentList)
      Async bulk index. The collection is split into parts of one thousand.
      Parameters:
      solrDocumentList - the list to index
    • dropIndex

      public static void dropIndex()
      Drops the whole solr classification index.
    • getDescendants

      public static List<MCRCategory> getDescendants(MCRCategory category)
      Returns a list of all descendants. The list is unordered.
      Returns:
      list of descendants.
    • getAncestors

      public static LinkedList<MCRCategory> getAncestors(MCRCategory category)
      Returns a list of all ancestors. The list is ordered. The first element is always the root node and the last element is always the parent. If the element has no ancestor an empty list is returned.
      Returns:
      list of ancestors
    • toSolrDocument

      public static List<org.apache.solr.common.SolrInputDocument> toSolrDocument(Collection<MCRCategory> categoryList)
      Creates a new list of SolrInputDocument based on the given category list.
    • toSolrDocument

      public static List<org.apache.solr.common.SolrInputDocument> toSolrDocument(MCRCategLinkReference linkReference, Collection<MCRCategoryID> categories)
      Creates a new list of SolrInputDocument based on the given categories and the link.
    • reindex

      public static void reindex(MCRCategory... categories)
      Reindex a bunch of MCRCategory. Be aware that this method does not fail if a reindex of a single category causes an exception (its just logged).
      Parameters:
      categories - the categories to reindex
    • fromString

      public static Collection<MCRCategoryID> fromString(Collection<String> categoryIds)
      Returns a collection of category id instances.
      Parameters:
      categoryIds - list of category ids as string
    • reindex

      public static void reindex(Collection<MCRCategoryID> categoryIds)
    • getCore

      public static MCRSolrCore getCore()
      Returns the solr classification core.
    • encodeCategoryId

      public static String encodeCategoryId(MCRCategoryID classId)
      Encodes the mycore category id to a solr usable one.
      Parameters:
      classId - the id to encode