org.sakaiproject.search.component.service.impl
Class SearchIndexBuilderImpl

java.lang.Object
  extended by org.sakaiproject.search.component.service.impl.SearchIndexBuilderImpl
All Implemented Interfaces:
SearchIndexBuilder

public class SearchIndexBuilderImpl
extends Object
implements SearchIndexBuilder

Search index builder is expected to be registered in spring as org.sakaiproject.search.api.SearchIndexBuilder as a singleton. It receives resources which it adds to its list of pending documents to be indexed. A Separate thread then runs through the list of entities to be indexed, updating the index. Each time the index is updates an event is posted to force the Search components that are using the index to reload. Incremental updates to the Lucene index require that the searchers reload the index once the index writer has been built.

Author:
ieb

Constructor Summary
SearchIndexBuilderImpl()
           
 
Method Summary
 void addIndexQueueListener(IndexQueueListener indexQueueListener)
           
 void addResource(org.sakaiproject.event.api.Notification notification, org.sakaiproject.event.api.Event event)
          Add a resource to the indexing queue
 void destroy()
           
protected  void fireResourceAdded(String name)
           
 List<SearchBuilderItem> getAllSearchItems()
           
 List<EntityContentProducer> getContentProducers()
          get all the producers registerd, as a clone to avoid concurrent modification exceptions
 List<SearchBuilderItem> getGlobalMasterSearchItems()
           
 int getPendingDocuments()
           
 SearchBuilderItemDao getSearchBuilderItemDao()
           
 List<SearchBuilderItem> getSiteMasterSearchItems()
           
 void init()
           
 boolean isBuildQueueEmpty()
          return true if the queue is empty
 boolean isExcludeUserSites()
           
 boolean isOnlyIndexSearchToolSites()
           
 EntityContentProducer newEntityContentProducer(org.sakaiproject.event.api.Event event)
          get hold of an entity content producer using the event
 EntityContentProducer newEntityContentProducer(String ref)
          Generates a SearchableEntityProducer
 void rebuildIndex()
          Rebuild the index from the entities own stored state
 void rebuildIndex(String currentSiteId)
          Rebuild the index from the entities own stored state , just the supplied siteId
 void refreshIndex()
          refresh the index from the current stored state
 void refreshIndex(String currentSiteId)
          Refresh the index fo the supplied site.
 void registerEntityContentProducer(EntityContentProducer ecp)
          register an entity content producer to provide content to the search engine
 void removeIndexQueueListener(IndexQueueListener indexQueueListener)
           
 void setExcludeUserSites(boolean excludeUserSites)
           
 void setOnlyIndexSearchToolSites(boolean onlyIndexSearchToolSites)
           
 void setSearchBuilderItemDao(SearchBuilderItemDao searchBuilderItemDao)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchIndexBuilderImpl

public SearchIndexBuilderImpl()
Method Detail

init

public void init()

registerEntityContentProducer

public void registerEntityContentProducer(EntityContentProducer ecp)
register an entity content producer to provide content to the search engine

Specified by:
registerEntityContentProducer in interface SearchIndexBuilder

addResource

public void addResource(org.sakaiproject.event.api.Notification notification,
                        org.sakaiproject.event.api.Event event)
Add a resource to the indexing queue

Specified by:
addResource in interface SearchIndexBuilder

fireResourceAdded

protected void fireResourceAdded(String name)

addIndexQueueListener

public void addIndexQueueListener(IndexQueueListener indexQueueListener)

removeIndexQueueListener

public void removeIndexQueueListener(IndexQueueListener indexQueueListener)

refreshIndex

public void refreshIndex()
refresh the index from the current stored state

Specified by:
refreshIndex in interface SearchIndexBuilder

destroy

public void destroy()
Specified by:
destroy in interface SearchIndexBuilder

rebuildIndex

public void rebuildIndex()
Rebuild the index from the entities own stored state

Specified by:
rebuildIndex in interface SearchIndexBuilder

newEntityContentProducer

public EntityContentProducer newEntityContentProducer(String ref)
Generates a SearchableEntityProducer

Specified by:
newEntityContentProducer in interface SearchIndexBuilder
Parameters:
ref -
Returns:
Throws:
org.sakaiproject.exception.PermissionException
org.sakaiproject.exception.IdUnusedException
org.sakaiproject.exception.TypeException

newEntityContentProducer

public EntityContentProducer newEntityContentProducer(org.sakaiproject.event.api.Event event)
get hold of an entity content producer using the event

Specified by:
newEntityContentProducer in interface SearchIndexBuilder
Parameters:
event -
Returns:

getSearchBuilderItemDao

public SearchBuilderItemDao getSearchBuilderItemDao()
Returns:
Returns the searchBuilderItemDao.

setSearchBuilderItemDao

public void setSearchBuilderItemDao(SearchBuilderItemDao searchBuilderItemDao)
Parameters:
searchBuilderItemDao - The searchBuilderItemDao to set.

isBuildQueueEmpty

public boolean isBuildQueueEmpty()
return true if the queue is empty

Specified by:
isBuildQueueEmpty in interface SearchIndexBuilder

getContentProducers

public List<EntityContentProducer> getContentProducers()
get all the producers registerd, as a clone to avoid concurrent modification exceptions

Specified by:
getContentProducers in interface SearchIndexBuilder
Returns:

getPendingDocuments

public int getPendingDocuments()
Specified by:
getPendingDocuments in interface SearchIndexBuilder

rebuildIndex

public void rebuildIndex(String currentSiteId)
Rebuild the index from the entities own stored state , just the supplied siteId

Specified by:
rebuildIndex in interface SearchIndexBuilder

refreshIndex

public void refreshIndex(String currentSiteId)
Refresh the index fo the supplied site.

Specified by:
refreshIndex in interface SearchIndexBuilder

getAllSearchItems

public List<SearchBuilderItem> getAllSearchItems()
Specified by:
getAllSearchItems in interface SearchIndexBuilder

getGlobalMasterSearchItems

public List<SearchBuilderItem> getGlobalMasterSearchItems()
Specified by:
getGlobalMasterSearchItems in interface SearchIndexBuilder

getSiteMasterSearchItems

public List<SearchBuilderItem> getSiteMasterSearchItems()
Specified by:
getSiteMasterSearchItems in interface SearchIndexBuilder

isOnlyIndexSearchToolSites

public boolean isOnlyIndexSearchToolSites()
Specified by:
isOnlyIndexSearchToolSites in interface SearchIndexBuilder
Returns:
the onlyIndexSearchToolSites

setOnlyIndexSearchToolSites

public void setOnlyIndexSearchToolSites(boolean onlyIndexSearchToolSites)
Parameters:
onlyIndexSearchToolSites - the onlyIndexSearchToolSites to set

setExcludeUserSites

public void setExcludeUserSites(boolean excludeUserSites)

isExcludeUserSites

public boolean isExcludeUserSites()
Specified by:
isExcludeUserSites in interface SearchIndexBuilder


Copyright © 2003-2012 Sakai Project. All Rights Reserved.