Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.search
Class SearchEngineIndexer

    java.lang.Object
      org.modeshape.graph.search.SearchEngineIndexer

    @NotThreadSafe
    public class SearchEngineIndexer

extends Object

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

### SearchEngineIndexer

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

  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.

  Parameters:
    `context` - the context in which the indexing operations are to be performed
    `searchEngine` - the search engine that is to be updated
    `connectionFactory` - the factory for creating connections to the repository containing the content
    `maxDepthPerRead` - the maximum depth for issuing each read requests when indexing
  Throws:
    `IllegalArgumentException` - if the search engine or connection factory references are null, or if the maximum depth per read is not positive

Method Detail

### getSourceName

    public String getSourceName()

  Get the name of the source containing the content.

  Returns:
    the source name; never null

### reindex

    public SearchEngineIndexer reindex(String workspaceName,
                                       boolean forceIndexRebuild)
                                throws RepositorySourceException,
                                       SearchEngineException

  Re-index all of the content in the named workspace within the `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.

  Parameters:
    `workspaceName` - the name of the workspace
    `forceIndexRebuild` - indicates that the index should be rebuilt even if it already exists
  Returns:
    this object for convenience in method chaining; never null
  Throws:
    `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 exist

### index

    public SearchEngineIndexer index(String workspaceName)
                              throws RepositorySourceException,
                                     SearchEngineException

  Index all of the content in the named workspace within the `source`. This method operates synchronously and returns when the requested indexing is completed.

  Parameters:
    `workspaceName` - the name of the workspace
  Returns:
    this object for convenience in method chaining; never null
  Throws:
    `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 exist

### indexAllWorkspaces

    public SearchEngineIndexer indexAllWorkspaces()
                                           throws RepositorySourceException,
                                                  SearchEngineException

  Index (or re-index) all of the content in all of the workspaces within the source. This method operates synchronously and returns when the requested indexing is completed.

  Returns:
    this object for convenience in method chaining; never null
  Throws:
    `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 positive

### index

    public SearchEngineIndexer index(String workspaceName,
                                     Path path)

  Crawl and index the full subgraph content starting at the supplied path in the named workspace.

  Parameters:
    `workspaceName` - the name of the workspace
    `path` - the path of the content to be indexed
  Returns:
    this object for convenience in method chaining; never null
  Throws:
    `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 name

### index

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

  Parameters:
    `workspaceName` - the name of the workspace
    `path` - the path of the content to be indexed
    `depth` - the depth of the content to be indexed
  Returns:
    this object for convenience in method chaining; never null
  Throws:
    `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 name

### index

    public SearchEngineIndexer index(String workspaceName,
                                     Location location)

  Crawl and index the full subgraph content starting at the supplied location in the named workspace.

  Parameters:
    `workspaceName` - the name of the workspace
    `location` - the location of the content to be indexed
  Returns:
    this object for convenience in method chaining; never null
  Throws:
    `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 name

### index

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

  Parameters:
    `workspaceName` - the name of the workspace
    `location` - the location of the content to be indexed
    `depth` - the depth of the content to be indexed
  Returns:
    this object for convenience in method chaining; never null
  Throws:
    `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 name

### indexSubgraph

    protected void indexSubgraph(String workspaceName,
                                 Location startingLocation,
                                 int depth)

### indexProperties

    protected void indexProperties(String workspaceName,
                                   Location location)

### process

    public final void process(ChangeRequest searchEngineRequest)

  Send the supplied change request directly to the search engine's processor.

  Parameters:
    `searchEngineRequest` -

### checkRequestForErrors

    protected final void checkRequestForErrors(Request request)
                                        throws RepositorySourceException,
                                               RuntimeException

  Throws:
    `RepositorySourceException`
    `RuntimeException`

### checkNotClosed

    protected final void checkNotClosed()
                                 throws IllegalStateException

  Throws:
    `IllegalStateException`

### isClosed

    public boolean isClosed()

  Return whether this indexer has already been `closed`.

  Returns:
    true if this has been closed, or false if it is still usable
  See Also:
    `close()`

### close

    public void close()

  Close this indexer and release all resources. This method has no effect if it is called when this indexer is alread closed.

  See Also:
    `isClosed()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.