Interface IndexerQueryContextFactory<T extends IndexerQueryContext>
-
- All Known Implementing Classes:
DefaultIndexerQueryContextFactory
public interface IndexerQueryContextFactory<T extends IndexerQueryContext>Implementations of this interface are responsible for creating and destroying instances ofIndexerQueryContext.Code creating/destroying contexts should normally use the following pattern:
try { final IndexerQueryContext context = indexerQueryContextFactory.createContext(facetSearchConfig, indexedType, query, queryParameters); // call additional setters on the context object indexerQueryContextFactory.initializeContext(); // put your logic here indexerQueryContextFactory.destroyContext(); } catch (final IndexerException | ... | RuntimeException exception) { indexerQueryContextFactory.destroyContext(exception); throw exception; }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TcreateContext(FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> queryParameters)Creates a new indexer context and sets it as current.voiddestroyContext()Destroys the current context.voiddestroyContext(java.lang.Exception exception)Destroys the current context because an exception occurred.TgetContext()Returns the current context.voidinitializeContext()Initializes the current context and executes the before index listeners (seeIndexerListener.beforeIndex(IndexerContext)).
-
-
-
Method Detail
-
createContext
T createContext(FacetSearchConfig facetSearchConfig, IndexedType indexedType, java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> queryParameters) throws IndexerException
Creates a new indexer context and sets it as current.- Parameters:
facetSearchConfig- - the facet search configurationindexedType- - the indexed typequery- - the queryqueryParameters- - the query parameters- Returns:
- the new context
- Throws:
IndexerException- if an error occurs during the listeners execution
-
initializeContext
void initializeContext() throws IndexerExceptionInitializes the current context and executes the before index listeners (seeIndexerListener.beforeIndex(IndexerContext)).- Throws:
IndexerException- if an error occurs during the listeners execution
-
getContext
T getContext()
Returns the current context.- Returns:
- the current context
-
destroyContext
void destroyContext() throws IndexerExceptionDestroys the current context. Before destroying an active context it executes the after query listeners (seeIndexerQueryListener.afterQuery(IndexerQueryContext)).- Throws:
IndexerException- if an error occurs during the listeners execution
-
destroyContext
void destroyContext(java.lang.Exception exception)
Destroys the current context because an exception occurred. Before destroying an active context it executes the after query error listeners (seeIndexerQueryListener.afterQueryError(IndexerQueryContext)).
-
-