Interface SearchIndexer
-
- All Superinterfaces:
Application.Component,Application.Module
- All Known Implementing Classes:
SearchIndexerImpl
public interface SearchIndexer extends Application.Module
Interface for the code that controls the contents of the search index. The search indexer is started rather late in the startup sequence, since it requires the search engine, the triple stores and the filters. If calls are made to schedule tasks prior to startup(), they will be queued. Calls to pause or unpause set the state as expected, but tasks will not be run until the indexer is both started and unpaused. The only calls that are valid after shutdown are shutdown(), getStatus() and removeListener(). Calls to other methods produce a warning, but have no other effect.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSearchIndexer.EventAn immutable event object.static interfaceSearchIndexer.ListenerA listener that will be notified of events from the SearchIndexer.-
Nested classes/interfaces inherited from interface edu.cornell.mannlib.vitro.webapp.modules.Application.Component
Application.Component.LifecycleState
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(SearchIndexer.Listener listener)Add this listener, allowing it to receive events from the indexer.SearchIndexerStatusgetStatus()What is the current status of the indexer? Still valid after shutdown().voidpause()Stop processing new tasks.voidrebuildIndex()Remove all of the existing documents in the index, and schedule updates for all of the individuals in the model.voidremoveListener(SearchIndexer.Listener listener)Remove this listener, meaning that it will no longer receive events from the indexer.voidscheduleUpdatesForStatements(List<org.apache.jena.rdf.model.Statement> changes)Update any search documents that are affected by these statements.voidscheduleUpdatesForUris(Collection<String> uris)Update the search documents for these URIs.voidshutdown(Application app)Stop processing and release resources.voidstartup(Application app, ComponentStartupStatus ss)Start processing.voidunpause()Resume processing new tasks.
-
-
-
Method Detail
-
startup
void startup(Application app, ComponentStartupStatus ss)
Start processing. If unpaused, schedule any queued tasks.- Specified by:
startupin interfaceApplication.Component- Throws:
IllegalStateException- if called after shutdown, or if called more than once.
-
pause
void pause()
Stop processing new tasks. Requests will be queued until a call to unpause(). Fires a PAUSED event to listeners. This call has no effect if already paused, or if called after shutdown.
-
unpause
void unpause()
Resume processing new tasks. Any requests that were received since the call to pause() will now be scheduled for processing. Fires an UNPAUSED event to listeners. If startup has not been called, the unpaused state will be recorded, but tasks will still await the call to startup. This call has no effect if not paused, or if called after shutdown.
-
shutdown
void shutdown(Application app)
Stop processing and release resources. This call should block until the dependent threads are stopped. Repeated calls have no effect.- Specified by:
shutdownin interfaceApplication.Component
-
scheduleUpdatesForStatements
void scheduleUpdatesForStatements(List<org.apache.jena.rdf.model.Statement> changes)
Update any search documents that are affected by these statements. These statements are a mixture of additions and deletions. In either case, we feed them to the URI finders to see what individuals might have been affected by the change. We accumulate a batch of affected URIs, removing duplicates if they occur, and then submit them for updates. If called before startup or while paused, the task will be queued. If called after shutdown, this has no effect.- Parameters:
changes- if null or empty, this call has no effect.
-
scheduleUpdatesForUris
void scheduleUpdatesForUris(Collection<String> uris)
Update the search documents for these URIs. For each URI that belongs in the index, a new search document is built, replacing any document that may already exist for that URI. For each URI that does not belong in the index, any existing document is removed. A URI belongs in the index if it refers to an existing individual in the model, and is not excluded. If called before startup or while paused, the task will be queued. If called after shutdown, this has no effect.- Parameters:
uris- if null or empty, this call has no effect.
-
rebuildIndex
void rebuildIndex()
Remove all of the existing documents in the index, and schedule updates for all of the individuals in the model. If a rebuild is already pending or in progress, this method has no effect. If called before startup or while paused, the task will be queued. If called after shutdown, this has no effect.
-
getStatus
SearchIndexerStatus getStatus()
What is the current status of the indexer? Still valid after shutdown().
-
addListener
void addListener(SearchIndexer.Listener listener)
Add this listener, allowing it to receive events from the indexer. The listener can safely assume that the SearchIndexer is not paused. If the SearchIndexer is indeed paused when the listener is added, then a PAUSE event will immediately be passed to the listener. If this listener has already been added, or if called after shutdown, this method has no effect.- Parameters:
listener- if null, this method has no effect.
-
removeListener
void removeListener(SearchIndexer.Listener listener)
Remove this listener, meaning that it will no longer receive events from the indexer. If this listener is not active, or if called after shutdown, this method has no effect.- Parameters:
listener- if null, this method has no effect.
-
-