|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.search.SearchEngineIndexer
@NotThreadSafe public class SearchEngineIndexer
A utility class that can be used to update the indexes of a search engine by crawling parts of the source. Each instance is created to make a series of atomic updates to the search engine using a single connection to the source.
Nested Class Summary | |
---|---|
static class |
SearchEngineIndexer.DeleteChildrenToDepthRequest
A specialization of DeleteChildrenRequest to delete from the search engine indexes only those nodes that are
children of the specified nodes or descendants down to a maximum depth. |
Constructor Summary | |
---|---|
SearchEngineIndexer(ExecutionContext context,
SearchEngine searchEngine,
RepositoryConnectionFactory connectionFactory,
int maxDepthPerRead)
Create an indexer that will update the indexes in the supplied search engine by crawling content, using the supplied connection factory to obtain connections. |
Method Summary | |
---|---|
protected void |
checkNotClosed()
|
protected void |
checkRequestForErrors(Request request)
|
void |
close()
Close this indexer and release all resources. |
String |
getSourceName()
Get the name of the source containing the content. |
SearchEngineIndexer |
index(String workspaceName)
Index all of the content in the named workspace within the source . |
SearchEngineIndexer |
index(String workspaceName,
Location location)
Crawl and index the full subgraph content starting at the supplied location in the named workspace. |
SearchEngineIndexer |
index(String workspaceName,
Location location,
int depth)
Crawl and index the content starting at the supplied location in the named workspace, to the designated depth. |
SearchEngineIndexer |
index(String workspaceName,
Path path)
Crawl and index the full subgraph content starting at the supplied path in the named workspace. |
SearchEngineIndexer |
index(String workspaceName,
Path path,
int depth)
Crawl and index the content starting at the supplied path in the named workspace, to the designated depth. |
SearchEngineIndexer |
indexAllWorkspaces()
Index (or re-index) all of the content in all of the workspaces within the source. |
protected void |
indexProperties(String workspaceName,
Location location)
|
protected void |
indexSubgraph(String workspaceName,
Location startingLocation,
int depth)
|
boolean |
isClosed()
Return whether this indexer has already been closed . |
void |
process(ChangeRequest searchEngineRequest)
Send the supplied change request directly to the search engine's processor. |
SearchEngineIndexer |
reindex(String workspaceName,
boolean forceIndexRebuild)
Re-index all of the content in the named workspace within the source . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SearchEngineIndexer(ExecutionContext context, SearchEngine searchEngine, RepositoryConnectionFactory connectionFactory, int maxDepthPerRead)
As soon as this indexer is created, it establishes a connection to the underlying source and is ready to being retrieving
content from the source and using it to update the indexes. Therefore, the instance must be
closed
when completed.
context
- the context in which the indexing operations are to be performedsearchEngine
- the search engine that is to be updatedconnectionFactory
- the factory for creating connections to the repository containing the contentmaxDepthPerRead
- the maximum depth for issuing each read requests when indexing
IllegalArgumentException
- if the search engine or connection factory references are null, or if the maximum depth
per read is not positiveMethod Detail |
---|
public String getSourceName()
public SearchEngineIndexer reindex(String workspaceName, boolean forceIndexRebuild) throws RepositorySourceException, SearchEngineException
source
. This method operates
synchronously and returns when the requested indexing is completed. If dontForceIndexRebuild == true
and the index
for the workspace already exists, this method will not rebuild the index.
workspaceName
- the name of the workspaceforceIndexRebuild
- indicates that the index should be rebuilt even if it already exists
IllegalArgumentException
- if the context or workspace name is null, or if the depth per read is not positive
RepositorySourceException
- if there is a problem accessing the content
SearchEngineException
- if there is a problem updating the indexes
InvalidWorkspaceException
- if the workspace does not existpublic SearchEngineIndexer index(String workspaceName) throws RepositorySourceException, SearchEngineException
source
. This method operates
synchronously and returns when the requested indexing is completed.
workspaceName
- the name of the workspace
IllegalArgumentException
- if the context or workspace name is null, or if the depth per read is not positive
RepositorySourceException
- if there is a problem accessing the content
SearchEngineException
- if there is a problem updating the indexes
InvalidWorkspaceException
- if the workspace does not existpublic SearchEngineIndexer indexAllWorkspaces() throws RepositorySourceException, SearchEngineException
RepositorySourceException
- if there is a problem accessing the content
SearchEngineException
- if there is a problem updating the indexes
IllegalArgumentException
- if the context is null, or if depth per read is not positivepublic SearchEngineIndexer index(String workspaceName, Path path)
workspaceName
- the name of the workspacepath
- the path of the content to be indexed
IllegalArgumentException
- if the workspace name or location are null, or if the depth is less than 1
IllegalStateException
- if this object has already been closed
InvalidWorkspaceException
- if there is no workspace with the supplied namepublic SearchEngineIndexer index(String workspaceName, Path path, int depth)
workspaceName
- the name of the workspacepath
- the path of the content to be indexeddepth
- the depth of the content to be indexed
IllegalArgumentException
- if the workspace name or location are null, or if the depth is less than 1
IllegalStateException
- if this object has already been closed
InvalidWorkspaceException
- if there is no workspace with the supplied namepublic SearchEngineIndexer index(String workspaceName, Location location)
workspaceName
- the name of the workspacelocation
- the location of the content to be indexed
IllegalArgumentException
- if the workspace name or location are null, or if the depth is less than 1
InvalidWorkspaceException
- if there is no workspace with the supplied namepublic SearchEngineIndexer index(String workspaceName, Location location, int depth)
workspaceName
- the name of the workspacelocation
- the location of the content to be indexeddepth
- the depth of the content to be indexed
IllegalArgumentException
- if the workspace name or location are null, or if the depth is less than 1
IllegalStateException
- if this object has already been closed
InvalidWorkspaceException
- if there is no workspace with the supplied nameprotected void indexSubgraph(String workspaceName, Location startingLocation, int depth)
protected void indexProperties(String workspaceName, Location location)
public final void process(ChangeRequest searchEngineRequest)
searchEngineRequest
- protected final void checkRequestForErrors(Request request) throws RepositorySourceException, RuntimeException
RepositorySourceException
RuntimeException
protected final void checkNotClosed() throws IllegalStateException
IllegalStateException
public boolean isClosed()
closed
.
close()
public void close()
isClosed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |