org.alfresco.repo.search.impl.lucene
Class ADMLuceneIndexerImpl

java.lang.Object
  extended by org.alfresco.repo.search.impl.lucene.AbstractLuceneBase
      extended by org.alfresco.repo.search.impl.lucene.AbstractLuceneIndexerImpl
          extended by org.alfresco.repo.search.impl.lucene.ADMLuceneIndexerImpl
All Implemented Interfaces:
BackgroundIndexerAware, ADMLuceneIndexer, LuceneIndexer, Indexer, SupportsBackgroundIndexing, TransactionSynchronisationAwareIndexer
Direct Known Subclasses:
ADMLuceneNoActionIndexerImpl

public class ADMLuceneIndexerImpl
extends AbstractLuceneIndexerImpl
implements ADMLuceneIndexer

The implementation of the lucene based indexer. Supports basic transactional behaviour if used on its own.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.alfresco.repo.search.impl.lucene.AbstractLuceneIndexerImpl
AbstractLuceneIndexerImpl.Action, AbstractLuceneIndexerImpl.Command, AbstractLuceneIndexerImpl.FTSStatus, AbstractLuceneIndexerImpl.IndexUpdateStatus
 
Field Summary
 
Fields inherited from class org.alfresco.repo.search.impl.lucene.AbstractLuceneIndexerImpl
commandList, containerDeletions, deletions, docs, indexUpdateStatus, maxAtomicTransformationTime, NOT_INDEXED_CONTENT_MISSING, NOT_INDEXED_NO_TRANSFORMATION, NOT_INDEXED_NO_TYPE_CONVERSION, NOT_INDEXED_TRANSFORMATION_FAILED, transactionService
 
Fields inherited from class org.alfresco.repo.search.impl.lucene.AbstractLuceneBase
deltaId, store
 
Method Summary
 void createChildRelationship(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipRef)
          Create a refernce link between a parent and child.
 java.util.List createDocuments(java.lang.String stringNodeRef, AbstractLuceneIndexerImpl.FTSStatus ftsStatus, boolean indexAllProperties, boolean includeDirectoryDocuments, boolean cascade, java.util.Set pathsProcessedSinceFlush, java.util.Map childAssociationsSinceFlush, org.apache.lucene.index.IndexReader deltaReader, org.apache.lucene.index.IndexReader mainReader)
           
 void createNode(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipRef)
          Create an index entry when a new node is created.
 void deleteChildRelationship(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipRef)
          Delete a relationship between a parent and child.
protected  java.util.Set deleteImpl(java.lang.String nodeRef, org.apache.lucene.index.IndexReader deltaReader, org.apache.lucene.index.IndexReader mainReader)
           
 void deleteIndex(org.alfresco.service.cmr.repository.StoreRef storeRef)
          Delete the index for a store
 void deleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipRef)
          Delete a node entry from an index.
protected  void doCommit()
           
protected  void doPrepare()
           
protected  void doRollBack()
           
protected  void doSetRollbackOnly()
           
 void flushPending()
           
 boolean getDeleteOnlyNodes()
          Are we deleting leaves only (not meta data)
static ADMLuceneNoActionIndexerImpl getNoActionIndexer(org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.String deltaId, LuceneConfig config)
           
static ADMLuceneIndexerImpl getUpdateIndexer(org.alfresco.service.cmr.repository.StoreRef storeRef, java.lang.String deltaId, LuceneConfig config)
          Generate an indexer
protected  boolean indexProperty(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName propertyName, java.io.Serializable value, org.apache.lucene.document.Document doc, boolean indexAtomicPropertiesOnly, boolean isContentIndexedForNode)
           
protected  java.util.List readDocuments(java.lang.String stringNodeRef, AbstractLuceneIndexerImpl.FTSStatus ftsStatus, boolean indexAllProperties, boolean includeDirectoryDocuments, boolean cascade, java.util.Set pathsProcessedSinceFlush, java.util.Map childAssociationsSinceFlush, org.apache.lucene.index.IndexReader deltaReader, org.apache.lucene.index.IndexReader mainReader)
           
 void registerCallBack(FTSIndexerAware callBack)
          Register call back handler when the indexing chunk is done
 void setContentService(ContentService contentService)
          IOC setting of the content service
 void setFullTextSearchIndexer(FullTextSearchIndexer fullTextSearchIndexer)
          Set the back ground indexer manager
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
          IOC setting of the node service
 void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
          IOC setting of the tenant service
 void updateChildRelationship(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipBeforeRef, org.alfresco.service.cmr.repository.ChildAssociationRef relationshipAfterRef)
          Alter the relationship between parent and child nodes in the index.
 int updateFullTextSearch(int size)
          Peform a chunk of background FTS (and other non atomic property) indexing
 void updateNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Update an index entry due to property changes on a node.
 
Methods inherited from class org.alfresco.repo.search.impl.lucene.AbstractLuceneIndexerImpl
checkAbleToDoWork, commit, delete, deleteContainerAndBelow, deleteLeafOnly, deletePrimary, deleteReference, doInReadthroughTransaction, getContainerDeletions, getDeletions, index, isModified, locateContainer, prepare, reindex, rollback, setMaxAtomicTransformationTime, setReadThrough, setRollbackOnly, setTransactionService
 
Methods inherited from class org.alfresco.repo.search.impl.lucene.AbstractLuceneBase
closeDeltaReader, closeDeltaWriter, deleteIndex, doReadOnly, getDeltaId, getDeltaReader, getDeltaWriter, getDictionaryService, getLuceneConfig, getReader, getSearcher, getSearcher, getStatus, initialise, saveDelta, setDictionaryService, setInfo, setLuceneConfig, setStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.alfresco.repo.search.impl.lucene.LuceneIndexer
doReadOnly, getContainerDeletions, getDeletions, getDeltaId
 
Methods inherited from interface org.alfresco.repo.search.Indexer
setReadThrough
 
Methods inherited from interface org.alfresco.repo.search.TransactionSynchronisationAwareIndexer
commit, isModified, prepare, rollback
 

Method Detail

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
IOC setting of the node service

Parameters:
nodeService -

setTenantService

public void setTenantService(org.alfresco.repo.tenant.TenantService tenantService)
IOC setting of the tenant service

Parameters:
tenantService -

setContentService

public void setContentService(ContentService contentService)
IOC setting of the content service

Parameters:
contentService -

createNode

public void createNode(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipRef)
                throws LuceneIndexException
Description copied from interface: Indexer
Create an index entry when a new node is created. A node is always created with a name in a given parent and so a relationship ref is required.

Specified by:
createNode in interface Indexer
Throws:
LuceneIndexException

updateNode

public void updateNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
                throws LuceneIndexException
Description copied from interface: Indexer
Update an index entry due to property changes on a node. There are no strucural impications from such a change.

Specified by:
updateNode in interface Indexer
Throws:
LuceneIndexException

deleteNode

public void deleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipRef)
                throws LuceneIndexException
Description copied from interface: Indexer
Delete a node entry from an index. This implies structural change. The node will be deleted from the index. This will also remove any remaining refernces to the node from the index. The index has no idea of the primary link.

Specified by:
deleteNode in interface Indexer
Throws:
LuceneIndexException

createChildRelationship

public void createChildRelationship(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipRef)
                             throws LuceneIndexException
Description copied from interface: Indexer
Create a refernce link between a parent and child. Implies only (potential) structural changes

Specified by:
createChildRelationship in interface Indexer
Throws:
LuceneIndexException

updateChildRelationship

public void updateChildRelationship(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipBeforeRef,
                                    org.alfresco.service.cmr.repository.ChildAssociationRef relationshipAfterRef)
                             throws LuceneIndexException
Description copied from interface: Indexer
Alter the relationship between parent and child nodes in the index. This can be used for:
  1. rename,
  2. move,
  3. move and rename,
  4. replace
This could be implemented as a delete and add but some implementations may be able to optimise this operation.

Specified by:
updateChildRelationship in interface Indexer
Throws:
LuceneIndexException

deleteChildRelationship

public void deleteChildRelationship(org.alfresco.service.cmr.repository.ChildAssociationRef relationshipRef)
                             throws LuceneIndexException
Description copied from interface: Indexer
Delete a relationship between a parent and child. This will remove a structural route through the index. The index has no idea of reference and primary relationships and will happily remove the primary relationship before refernces which could remain. Use delete to ensure all strctural references are removed or call this sure you are doing an unlink (remove a hard link in the unix file system world).

Specified by:
deleteChildRelationship in interface Indexer
Throws:
LuceneIndexException

getDeleteOnlyNodes

public boolean getDeleteOnlyNodes()
Are we deleting leaves only (not meta data)

Specified by:
getDeleteOnlyNodes in interface LuceneIndexer
Returns:
- deleting only nodes.

getUpdateIndexer

public static ADMLuceneIndexerImpl getUpdateIndexer(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                    java.lang.String deltaId,
                                                    LuceneConfig config)
                                             throws LuceneIndexException
Generate an indexer

Parameters:
storeRef -
deltaId -
config -
Returns:
- the indexer instance
Throws:
LuceneIndexException

getNoActionIndexer

public static ADMLuceneNoActionIndexerImpl getNoActionIndexer(org.alfresco.service.cmr.repository.StoreRef storeRef,
                                                              java.lang.String deltaId,
                                                              LuceneConfig config)
                                                       throws LuceneIndexException
Throws:
LuceneIndexException

deleteImpl

protected java.util.Set deleteImpl(java.lang.String nodeRef,
                                   org.apache.lucene.index.IndexReader deltaReader,
                                   org.apache.lucene.index.IndexReader mainReader)
                            throws LuceneIndexException,
                                   java.io.IOException
Throws:
LuceneIndexException
java.io.IOException

createDocuments

public java.util.List createDocuments(java.lang.String stringNodeRef,
                                      AbstractLuceneIndexerImpl.FTSStatus ftsStatus,
                                      boolean indexAllProperties,
                                      boolean includeDirectoryDocuments,
                                      boolean cascade,
                                      java.util.Set pathsProcessedSinceFlush,
                                      java.util.Map childAssociationsSinceFlush,
                                      org.apache.lucene.index.IndexReader deltaReader,
                                      org.apache.lucene.index.IndexReader mainReader)

flushPending

public void flushPending()
                  throws LuceneIndexException
Specified by:
flushPending in interface Indexer
Throws:
LuceneIndexException

indexProperty

protected boolean indexProperty(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                org.alfresco.service.namespace.QName propertyName,
                                java.io.Serializable value,
                                org.apache.lucene.document.Document doc,
                                boolean indexAtomicPropertiesOnly,
                                boolean isContentIndexedForNode)
Parameters:
indexAtomicPropertiesOnly - true to ignore all properties that must be indexed non-atomically
Returns:
Returns true if the property was indexed atomically, or false if it should be done asynchronously

updateFullTextSearch

public int updateFullTextSearch(int size)
                         throws LuceneIndexException
Description copied from interface: BackgroundIndexerAware
Peform a chunk of background FTS (and other non atomic property) indexing

Specified by:
updateFullTextSearch in interface BackgroundIndexerAware
Returns:
- the number of docs updates
Throws:
LuceneIndexException

readDocuments

protected java.util.List readDocuments(java.lang.String stringNodeRef,
                                       AbstractLuceneIndexerImpl.FTSStatus ftsStatus,
                                       boolean indexAllProperties,
                                       boolean includeDirectoryDocuments,
                                       boolean cascade,
                                       java.util.Set pathsProcessedSinceFlush,
                                       java.util.Map childAssociationsSinceFlush,
                                       org.apache.lucene.index.IndexReader deltaReader,
                                       org.apache.lucene.index.IndexReader mainReader)

registerCallBack

public void registerCallBack(FTSIndexerAware callBack)
Description copied from interface: BackgroundIndexerAware
Register call back handler when the indexing chunk is done

Specified by:
registerCallBack in interface BackgroundIndexerAware

setFullTextSearchIndexer

public void setFullTextSearchIndexer(FullTextSearchIndexer fullTextSearchIndexer)
Description copied from interface: SupportsBackgroundIndexing
Set the back ground indexer manager

Specified by:
setFullTextSearchIndexer in interface SupportsBackgroundIndexing

doPrepare

protected void doPrepare()
                  throws java.io.IOException
Specified by:
doPrepare in class AbstractLuceneIndexerImpl
Throws:
java.io.IOException

doCommit

protected void doCommit()
                 throws java.io.IOException
Specified by:
doCommit in class AbstractLuceneIndexerImpl
Throws:
java.io.IOException

doRollBack

protected void doRollBack()
                   throws java.io.IOException
Specified by:
doRollBack in class AbstractLuceneIndexerImpl
Throws:
java.io.IOException

doSetRollbackOnly

protected void doSetRollbackOnly()
                          throws java.io.IOException
Specified by:
doSetRollbackOnly in class AbstractLuceneIndexerImpl
Throws:
java.io.IOException

deleteIndex

public void deleteIndex(org.alfresco.service.cmr.repository.StoreRef storeRef)
Description copied from interface: Indexer
Delete the index for a store

Specified by:
deleteIndex in interface Indexer


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.