Interface FacetSearchContextFactory<T extends FacetSearchContext>
-
- All Known Implementing Classes:
DefaultFacetSearchContextFactory
public interface FacetSearchContextFactory<T extends FacetSearchContext>
Implementations of this interface are responsible for creating and destroying instances ofFacetSearchContext
.Code creating/destroying contexts should normally use the following pattern:
try { final FacetSearchContext facetSearchContext = facetSearchContextFactory.createContext(facetSearchConfig, indexedType, searchQuery); // call additional setters on the context object facetSearchContextFactory.initializeContext(); // put your logic here facetSearchContextFactory.destroyContext(); } catch (final FacetSearchException | ... | RuntimeException e) { facetSearchContextFactory.destroyContext(e); throw e; }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
createContext(FacetSearchConfig facetSearchConfig, IndexedType indexedType, SearchQuery searchQuery)
Creates a new facet search context and sets it as current one.void
destroyContext()
Destroys the current context.void
destroyContext(java.lang.Exception exception)
Destroys the current context because an exception occurred.T
getContext()
Returns the current context.void
initializeContext()
Initializes the current context and executes before search query listeners (seeFacetSearchListener.beforeSearch(FacetSearchContext)
).
-
-
-
Method Detail
-
createContext
T createContext(FacetSearchConfig facetSearchConfig, IndexedType indexedType, SearchQuery searchQuery)
Creates a new facet search context and sets it as current one.- Parameters:
facetSearchConfig
- - the facet search configurationindexedType
- - the indexed typesearchQuery
- - the search- Returns:
- the new context
-
initializeContext
void initializeContext() throws FacetSearchException
Initializes the current context and executes before search query listeners (seeFacetSearchListener.beforeSearch(FacetSearchContext)
).- Throws:
FacetSearchException
- if an error occurs during the listeners execution
-
getContext
T getContext()
Returns the current context.- Returns:
- the current context
-
destroyContext
void destroyContext() throws FacetSearchException
Destroys the current context. Before destroying an active context it executes the after search query listeners (seeFacetSearchListener.afterSearch(FacetSearchContext)
).- Throws:
FacetSearchException
- 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 batch error listeners (seeFacetSearchListener.afterSearchError(FacetSearchContext)
).
-
-