Class IndexationService
- java.lang.Object
-
- fr.paris.lutece.portal.service.search.IndexationService
-
public final class IndexationService extends Object
This class provides management methods for indexing
-
-
Field Summary
Fields Modifier and Type Field Description static intALL_DOCUMENTstatic org.apache.lucene.util.VersionLUCENE_INDEX_VERSIONstatic StringPARAM_FORCINGstatic StringPATH_INDEXstatic StringPATH_INDEX_IN_WEBAPP
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddIndexerAction(String strIdDocument, String indexerName, int nIdTask)Add Indexer Action to perform on a recordstatic voidaddIndexerAction(String strIdDocument, String indexerName, int nIdTask, int nIdPortlet)Add Indexer Action to perform on a recordstatic voiderror(IndexerAction action, Exception e, String strMessage)Log the error for the indexer action.static voiderror(SearchIndexer indexer, Exception e, String strMessage)Log the error for the search indexer.static List<IndexerAction>getAllIndexerActionByTask(int nIdTask)return a list of IndexerAction by task keystatic org.apache.lucene.analysis.AnalyzergetAnalyser()Gets the current analyserstatic org.apache.lucene.store.DirectorygetDirectoryIndex()Gets the current IndexSearcher.static Collection<SearchIndexer>getIndexers()Returns all search indexersstatic voidinit()Initalizes the servicestatic StringprocessIndexing(boolean bCreate)Process the indexingstatic voidregisterIndexer(SearchIndexer indexer)Register an indexerstatic voidremoveAllIndexerAction()Remove all Indexer Actionstatic voidremoveIndexerAction(int nIdAction)Remove a Indexer Actionstatic voidunregisterIndexer(SearchIndexer indexer)Unregister an indexer.static voidwrite(org.apache.lucene.document.Document doc)Index one document, called by plugin indexers
-
-
-
Field Detail
-
PATH_INDEX
public static final String PATH_INDEX
- See Also:
- Constant Field Values
-
PATH_INDEX_IN_WEBAPP
public static final String PATH_INDEX_IN_WEBAPP
- See Also:
- Constant Field Values
-
PARAM_FORCING
public static final String PARAM_FORCING
- See Also:
- Constant Field Values
-
ALL_DOCUMENT
public static final int ALL_DOCUMENT
- See Also:
- Constant Field Values
-
LUCENE_INDEX_VERSION
public static final org.apache.lucene.util.Version LUCENE_INDEX_VERSION
-
-
Method Detail
-
init
public static void init() throws LuteceInitExceptionInitalizes the service- Throws:
LuteceInitException- If an error occured
-
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 IOExceptionIndex one document, called by plugin indexers- Parameters:
doc- the document to index- Throws:
org.apache.lucene.index.CorruptIndexException- corruptIndexExceptionIOException- i/o exception
-
error
public static void error(SearchIndexer indexer, Exception e, String strMessage)
Log the error for the search indexer.- Parameters:
indexer- theSearchIndexere- the exceptionstrMessage- the str message
-
error
public static void error(IndexerAction action, Exception e, String strMessage)
Log the error for the indexer action.- Parameters:
action- theIndexerActione- the exceptionstrMessage- the str message
-
getDirectoryIndex
public static org.apache.lucene.store.Directory getDirectoryIndex() throws IOExceptionGets 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 documentindexerName- the name of the indexernIdTask- the key of the action to donIdPortlet- id of the portlet
-
-