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.IndexDeleteMode, AbstractLuceneIndexerImpl.IndexUpdateStatus
 
Field Summary
 
Fields inherited from class org.alfresco.repo.search.impl.lucene.AbstractLuceneIndexerImpl
commandList, deletions, docs, indexUpdateStatus, maxAtomicTransformationTime, NOT_INDEXED_CONTENT_MISSING, NOT_INDEXED_NO_TRANSFORMATION, NOT_INDEXED_NO_TYPE_CONVERSION, NOT_INDEXED_TRANSFORMATION_FAILED
 
Fields inherited from class org.alfresco.repo.search.impl.lucene.AbstractLuceneBase
deltaId, store
 
Method Summary
 void createChildRelationship(ChildAssociationRef relationshipRef)
          Create a refernce link between a parent and child.
 java.util.List createDocuments(java.lang.String stringNodeRef, boolean isNew, boolean indexAllProperties, boolean includeDirectoryDocuments)
           
 void createNode(ChildAssociationRef relationshipRef)
          Create an index entry when a new node is created.
 void deleteChildRelationship(ChildAssociationRef relationshipRef)
          Delete a relationship between a parent and child.
 void deleteIndex(StoreRef storeRef)
          Delete the index for a store
 void deleteNode(ChildAssociationRef relationshipRef)
          Delete a node entry from an index.
protected  void doCommit()
           
protected  void doPrepare()
           
protected  void doRollBack()
           
protected  void doSetRollbackOnly()
           
static ADMLuceneNoActionIndexerImpl getNoActionIndexer(StoreRef storeRef, java.lang.String deltaId, LuceneConfig config)
           
static ADMLuceneIndexerImpl getUpdateIndexer(StoreRef storeRef, java.lang.String deltaId, LuceneConfig config)
          Generate an indexer
protected  boolean indexProperty(NodeRef nodeRef, QName propertyName, java.io.Serializable value, org.apache.lucene.document.Document doc, boolean indexAtomicPropertiesOnly)
           
 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(NodeService nodeService)
          IOC setting of the node service
 void setTenantService(TenantService tenantService)
          IOC setting of the tenant service
 void updateChildRelationship(ChildAssociationRef relationshipBeforeRef, 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(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, deleteAll, deleteAll, deleteContainerAndBelow, deleteImpl, deletePrimary, deleteReference, flushPending, getDeleteOnlyNodes, getDeletions, index, indexImpl, isModified, move, prepare, reindex, rollback, setMaxAtomicTransformationTime, setRollbackOnly
 
Methods inherited from class org.alfresco.repo.search.impl.lucene.AbstractLuceneBase
closeDeltaReader, closeDeltaWriter, deleteIndex, doWithWriteLock, 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
doWithWriteLock, flushPending, getDeleteOnlyNodes, getDeletions, getDeltaId
 
Methods inherited from interface org.alfresco.repo.search.TransactionSynchronisationAwareIndexer
commit, isModified, prepare, rollback
 

Method Detail

setNodeService

public void setNodeService(NodeService nodeService)
IOC setting of the node service

Parameters:
nodeService -

setTenantService

public void setTenantService(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(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(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(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(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(ChildAssociationRef relationshipBeforeRef,
                                    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(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

getUpdateIndexer

public static ADMLuceneIndexerImpl getUpdateIndexer(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(StoreRef storeRef,
                                                              java.lang.String deltaId,
                                                              LuceneConfig config)
                                                       throws LuceneIndexException
Throws:
LuceneIndexException

createDocuments

public java.util.List createDocuments(java.lang.String stringNodeRef,
                                      boolean isNew,
                                      boolean indexAllProperties,
                                      boolean includeDirectoryDocuments)
Specified by:
createDocuments in class AbstractLuceneIndexerImpl

indexProperty

protected boolean indexProperty(NodeRef nodeRef,
                                QName propertyName,
                                java.io.Serializable value,
                                org.apache.lucene.document.Document doc,
                                boolean indexAtomicPropertiesOnly)
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

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(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.