Interface IndexerBatchContextFactory<T extends IndexerBatchContext>

  • Type Parameters:
    T - - the indexer batch context type
    All Known Implementing Classes:
    DefaultIndexerBatchContextFactory

    public interface IndexerBatchContextFactory<T extends IndexerBatchContext>
    Implementations of this interface are responsible for creating and destroying instances of IndexerBatchContext.

    Code creating/destroying contexts should normally use the following pattern:

     try
     {
            final IndexerBatchContext batchContext = indexerBatchContextFactory.createContext(externalIndexOperation, indexerOperation,
                            facetSearchConfig, indexedType, indexedProperties, items);
    
            // call additional setters on the context object
    
            indexerContextFactory.prepareContext();
    
            // call the setter for the PKs.
    
            indexerBatchContextFactory.initializeContext();
    
            // put your logic here
    
            indexerBatchContextFactory.destroyContext();
     }
     catch (final IndexerException | ... | RuntimeException e)
     {
            indexerBatchContextFactory.destroyContext(e);
            throw e;
     }