Class AbstractLuceneIndexerImpl<T>

  • Type Parameters:
    T - - the type used to generate the key in the index file
    All Implemented Interfaces:
    Indexer

    public abstract class AbstractLuceneIndexerImpl<T>
    extends AbstractLuceneBase
    implements Indexer
    Common support for indexing across implementations
    Author:
    andyh
    • Field Detail

      • docs

        protected long docs
      • NOT_INDEXED_NO_TRANSFORMATION

        public static final String NOT_INDEXED_NO_TRANSFORMATION
        No transform available
        See Also:
        Constant Field Values
      • NOT_INDEXED_TRANSFORMATION_FAILED

        public static final String NOT_INDEXED_TRANSFORMATION_FAILED
        Tranfrom failed
        See Also:
        Constant Field Values
      • NOT_INDEXED_NO_TYPE_CONVERSION

        public static final String NOT_INDEXED_NO_TYPE_CONVERSION
        No type conversion
        See Also:
        Constant Field Values
      • maxAtomicTransformationTime

        protected long maxAtomicTransformationTime
        the maximum transformation time to allow atomically, defaulting to 20ms
      • deletions

        protected Set<String> deletions
        A list of all deletions we have made - at merge these deletions need to be made against the main index. TODO: Consider if this information needs to be persisted for recovery
      • containerDeletions

        protected Set<String> containerDeletions
        A list of cascading container deletions we have made - at merge these deletions need to be made against the main index.
      • indexUpdateStatus

        protected AbstractLuceneIndexerImpl.IndexUpdateStatus indexUpdateStatus
        Flag to indicte if we are doing an in transactional delta or a batch update to the index. If true, we are just fixing up non atomically indexed things from one or more other updates.
    • Constructor Detail

      • AbstractLuceneIndexerImpl

        public AbstractLuceneIndexerImpl()
    • Method Detail

      • setReadThrough

        public void setReadThrough​(boolean isReadThrough)
        Description copied from interface: Indexer
        Activates 'read through' behaviour for this indexer. Rather than accessing the database through the current (potentially old) transaction, it will use a discrete read only transaction for each node it indexes. This avoids 'stale' nodes building up in the caches during long reindex runs.
        Specified by:
        setReadThrough in interface Indexer
        Parameters:
        isReadThrough - boolean
      • setTransactionService

        public void setTransactionService​(TransactionService transactionService)
      • setBulkLoader

        public void setBulkLoader​(NodeBulkLoader bulkLoader)
        Parameters:
        bulkLoader - object to provide node loading options
      • locateContainer

        protected boolean locateContainer​(String nodeRef,
                                          org.apache.lucene.index.IndexReader reader)
      • setMaxAtomicTransformationTime

        public void setMaxAtomicTransformationTime​(long maxAtomicTransformationTime)
        Set the max time allowed to transform content atomically
        Parameters:
        maxAtomicTransformationTime - long
      • prepare

        public int prepare()
                    throws LuceneIndexException
        Prepare to commit At the moment this makes sure we have all the locks TODO: This is not doing proper serialisation against the index as would a data base transaction.
        Returns:
        the tx state
        Throws:
        LuceneIndexException
      • isModified

        public boolean isModified()
        Has this index been modified?
        Returns:
        true if modified
      • setRollbackOnly

        public void setRollbackOnly()
        Mark this index for roll back only. This action can not be reversed. It will reject all other work and only allow roll back.
      • getDeletions

        public Set<String> getDeletions()
        Get the deletions
        Returns:
        - the ids to delete
      • getContainerDeletions

        public Set<String> getContainerDeletions()
        Get the container deletions
        Returns:
        - the ids to delete