org.modeshape.jcr.query.lucene

## Class LuceneQueryEngine

- java.lang.Object
- - org.modeshape.jcr.query.process.QueryEngine
  - - org.modeshape.jcr.query.lucene.LuceneQueryEngine

-     public class LuceneQueryEngine
      extends QueryEngine

  A `QueryEngine` that uses Lucene for answering queries. Each repository uses a single `LuceneQueryEngine` instance, and all sessions share the same engine. Therefore, this engine is threadsafe (and actually immutable), creating objects for each `submitted query`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `LuceneQueryEngine.LuceneAccessQuery` The component that is created to represent a single access query and, when executed, transforms that access query into a single Lucene query and issues it against Lucene.
    `protected static class` | `LuceneQueryEngine.LuceneQueryProcessor` The `QueryProcessor` implementation used by this `LuceneQueryEngine`.
    `static class` | `LuceneQueryEngine.TupleCollector`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Logger` | `LOGGER`

    - ### Fields inherited from class org.modeshape.jcr.query.process.QueryEngine

      `optimizer, planner, processor`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LuceneQueryEngine(ExecutionContext context, String repositoryName, Planner planner, Optimizer optimizer, org.hibernate.search.engine.spi.SearchFactoryImplementor searchFactory, org.apache.lucene.util.Version version, boolean enableFullTextSearch)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.hibernate.search.indexes.impl.IndexManagerHolder` | `getAllIndexesManager()` Returns the global index manager.
    `QueryIndexing` | `getQueryIndexing()` Get the interface for updating the indexes.
    `CancellableQuery` | `query(ExecutionContext context, RepositoryCache repositoryCache, Set<String> workspaceNames, Map<String,NodeCache> overriddenNodeCachesByWorkspaceName, QueryCommand query, Schemata schemata, PlanHints hints, Map<String,Object> variables)` Execute the supplied query against the named workspace, using the supplied hints, schemata and variables.
    `void` | `shutdown()` Shuts down the query engine

    - ### Methods inherited from class org.modeshape.jcr.query.process.QueryEngine

      `determineQueryResultColumns, execute`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LOGGER

          protected static final Logger LOGGER

  - ### Constructor Detail

    - #### LuceneQueryEngine

          public LuceneQueryEngine(ExecutionContext context,
                           String repositoryName,
                           Planner planner,
                           Optimizer optimizer,
                           org.hibernate.search.engine.spi.SearchFactoryImplementor searchFactory,
                           org.apache.lucene.util.Version version,
                           boolean enableFullTextSearch)

      Parameters:
        `context` - the execution context for the repository
        `repositoryName` - the name of the repository
        `planner` - the planner that should be used
        `optimizer` - the optimizer that should be used
        `searchFactory` - the search factory for accessing the indexes
        `version` - the Lucene version used by the indexes
        `enableFullTextSearch` - true if full-text searching is enabled, or false otherwise

  - ### Method Detail

    - #### shutdown

          public void shutdown()

      Shuts down the query engine

    - #### getAllIndexesManager

          public org.hibernate.search.indexes.impl.IndexManagerHolder getAllIndexesManager()

      Returns the global index manager.
      Returns:
        a `IndexManagerHolder` instance.

    - #### getQueryIndexing

          public QueryIndexing getQueryIndexing()

      Get the interface for updating the indexes.
      Returns:
        the indexing interface

    - #### query

          public CancellableQuery query(ExecutionContext context,
                               RepositoryCache repositoryCache,
                               Set<String> workspaceNames,
                               Map<String,NodeCache> overriddenNodeCachesByWorkspaceName,
                               QueryCommand query,
                               Schemata schemata,
                               PlanHints hints,
                               Map<String,Object> variables)
                                 throws InvalidQueryException

      Execute the supplied query against the named workspace, using the supplied hints, schemata and variables.
      Parameters:
        `context` - the context in which the query is being executed; may not be null
        `repositoryCache` - the repository cache that should be used to load results; may not be null
        `workspaceNames` - the name of each workspace to be queried, or an empty set if all the workspaces should be queried; may not be null
        `overriddenNodeCachesByWorkspaceName` - the NodeCache instances that should be used to load results, which will be used instead of the RepositoryCache's NodeCache for a given workspace name; may be null or empty
        `query` - the query
        `schemata` - the schemata information that should be used for all processing of this query
        `hints` - the hints
        `variables` - the variables
      Returns:
        the results
      Throws:
        `InvalidQueryException` - if the

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