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 of IndexerQueryContext.

    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 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 configuration
        indexedType - - the indexed type
        query - - the query
        queryParameters - - the query parameters
        Returns:
        the new context
        Throws:
        IndexerException - if an error occurs during the listeners execution
      • getContext

        T getContext()
        Returns the current context.
        Returns:
        the current context