Class IndexationService


  • public final class IndexationService
    extends Object
    This class provides management methods for indexing
    • Method Detail

      • registerIndexer

        public static void registerIndexer​(SearchIndexer indexer)
        Register an indexer
        Parameters:
        indexer - The indexer to add to the registry
      • unregisterIndexer

        public static void unregisterIndexer​(SearchIndexer indexer)
        Unregister an indexer. The indexer is only removed if its name has not changed
        Parameters:
        indexer - the indexer to remove from the registry
      • processIndexing

        public static String processIndexing​(boolean bCreate)
        Process the indexing
        Parameters:
        bCreate - Force creating the index
        Returns:
        the result log of the indexing
      • write

        public static void write​(org.apache.lucene.document.Document doc)
                          throws IOException
        Index one document, called by plugin indexers
        Parameters:
        doc - the document to index
        Throws:
        org.apache.lucene.index.CorruptIndexException - corruptIndexException
        IOException - i/o exception
      • error

        public static void error​(SearchIndexer indexer,
                                 Exception e,
                                 String strMessage)
        Log the error for the search indexer.
        Parameters:
        indexer - the SearchIndexer
        e - the exception
        strMessage - the str message
      • error

        public static void error​(IndexerAction action,
                                 Exception e,
                                 String strMessage)
        Log the error for the indexer action.
        Parameters:
        action - the IndexerAction
        e - the exception
        strMessage - the str message
      • getDirectoryIndex

        public static org.apache.lucene.store.Directory getDirectoryIndex()
                                                                   throws IOException
        Gets the current IndexSearcher.
        Returns:
        IndexSearcher
        Throws:
        IOException - Signals that an I/O exception has occurred.
      • getAnalyser

        public static org.apache.lucene.analysis.Analyzer getAnalyser()
        Gets the current analyser
        Returns:
        The analyser
      • getIndexers

        public static Collection<SearchIndexer> getIndexers()
        Returns all search indexers
        Returns:
        A collection of indexers
      • getAllIndexerActionByTask

        public static List<IndexerAction> getAllIndexerActionByTask​(int nIdTask)
        return a list of IndexerAction by task key
        Parameters:
        nIdTask - the task kety
        Returns:
        a list of IndexerAction
      • removeIndexerAction

        public static void removeIndexerAction​(int nIdAction)
        Remove a Indexer Action
        Parameters:
        nIdAction - the key of the action to remove
      • removeAllIndexerAction

        public static void removeAllIndexerAction()
        Remove all Indexer Action
      • addIndexerAction

        public static void addIndexerAction​(String strIdDocument,
                                            String indexerName,
                                            int nIdTask,
                                            int nIdPortlet)
        Add Indexer Action to perform on a record
        Parameters:
        strIdDocument - the id of the document
        indexerName - the name of the indexer
        nIdTask - the key of the action to do
        nIdPortlet - id of the portlet
      • addIndexerAction

        public static void addIndexerAction​(String strIdDocument,
                                            String indexerName,
                                            int nIdTask)
        Add Indexer Action to perform on a record
        Parameters:
        strIdDocument - the id of the document
        indexerName - the name of the indexer
        nIdTask - the key of the action to do