fr.paris.lutece.portal.service.search
Class IndexationService

java.lang.Object
  extended by fr.paris.lutece.portal.service.search.IndexationService

public final class IndexationService
extends java.lang.Object

This class provides management methods for indexing


Field Summary
static int ALL_DOCUMENT
           
static org.apache.lucene.util.Version LUCENE_INDEX_VERSION
           
static java.lang.String PARAM_FORCING
           
static java.lang.String PATH_INDEX
           
 
Method Summary
static void addIndexerAction(java.lang.String strIdDocument, java.lang.String indexerName, int nIdTask)
          Add Indexer Action to perform on a record
static void addIndexerAction(java.lang.String strIdDocument, java.lang.String indexerName, int nIdTask, int nIdPortlet)
          Add Indexer Action to perform on a record
static void error(IndexerAction action, java.lang.Exception e, java.lang.String strMessage)
          Log the error for the indexer action
static void error(SearchIndexer indexer, java.lang.Exception e, java.lang.String strMessage)
          Log the error for the search indexer
static java.util.List<IndexerAction> getAllIndexerActionByTask(int nIdTask)
          return a list of IndexerAction by task key
static org.apache.lucene.analysis.Analyzer getAnalyser()
          Gets the current analyser
static org.apache.lucene.store.Directory getDirectoryIndex()
          Gets the current IndexSearcher
static java.lang.String getIndex()
          Deprecated. use getDirectoryIndex( ) instead
static java.util.Collection<SearchIndexer> getIndexers()
          Returns all search indexers
static IndexationService getInstance()
           
static void init()
          Initalizes the service
static java.lang.String processIndexing(boolean bCreate)
          Process the indexing
static void registerIndexer(SearchIndexer indexer)
          Register an indexer
static void removeAllIndexerAction()
          Remove all Indexer Action
static void removeIndexerAction(int nIdAction)
          Remove a Indexer Action
static void write(org.apache.lucene.document.Document doc)
          Index one document, called by plugin indexers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH_INDEX

public static final java.lang.String PATH_INDEX
See Also:
Constant Field Values

PARAM_FORCING

public static final java.lang.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 org.apache.lucene.util.Version LUCENE_INDEX_VERSION
Method Detail

getInstance

public static IndexationService getInstance()
Returns:
singleton

init

public static void init()
                 throws LuteceInitException
Initalizes 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

processIndexing

public static java.lang.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 org.apache.lucene.index.CorruptIndexException,
                         java.io.IOException
Index one document, called by plugin indexers

Parameters:
doc - the document to index
Throws:
org.apache.lucene.index.CorruptIndexException - corruptIndexException
java.io.IOException - i/o exception

error

public static void error(SearchIndexer indexer,
                         java.lang.Exception e,
                         java.lang.String strMessage)
Log the error for the search indexer

Parameters:
indexer - the SearchIndexer
e - the exception

error

public static void error(IndexerAction action,
                         java.lang.Exception e,
                         java.lang.String strMessage)
Log the error for the indexer action

Parameters:
action - the IndexerAction
e - the exception

getIndex

@Deprecated
public static java.lang.String getIndex()
Deprecated. use getDirectoryIndex( ) instead

Gets the current index

Returns:
The index

getDirectoryIndex

public static org.apache.lucene.store.Directory getDirectoryIndex()
                                                           throws java.io.IOException
Gets the current IndexSearcher

Returns:
IndexSearcher
Throws:
java.io.IOException

getAnalyser

public static org.apache.lucene.analysis.Analyzer getAnalyser()
Gets the current analyser

Returns:
The analyser

getIndexers

public static java.util.Collection<SearchIndexer> getIndexers()
Returns all search indexers

Returns:
A collection of indexers

getAllIndexerActionByTask

public static java.util.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(java.lang.String strIdDocument,
                                    java.lang.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(java.lang.String strIdDocument,
                                    java.lang.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


Copyright © 2011 Mairie de Paris. All Rights Reserved.