org.modeshape.jcr.query.lucene.basic

## Class BasicLuceneSchema

- java.lang.Object
- - org.modeshape.jcr.query.lucene.basic.BasicLuceneSchema

- All Implemented Interfaces:
    LuceneSchema, QueryIndexing

      public class BasicLuceneSchema
      extends Object
      implements LuceneSchema

  The LuceneSchema implementation that uses a single index for `node information`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicLuceneSchema(ExecutionContext context, org.hibernate.search.engine.spi.SearchFactoryImplementor searchFactory, org.apache.lucene.util.Version version, boolean enableFullTextSearch)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBinaryToIndex(Binary binary, org.hibernate.search.backend.TransactionContext txnCtx)`
    `protected DynamicField` | `addDynamicField(String propertyName, Object value, DynamicField previous, org.apache.lucene.document.Field.Store stored, boolean fullTextSearchable, StringBuilder fullText)` Create a dynamic field to store the property value.
    `void` | `addToIndex(String workspace, NodeKey key, Path path, Name primaryType, Set<Name> mixinTypes, Iterator<Property> propertiesIterator, NodeTypeSchemata schemata, org.hibernate.search.backend.TransactionContext txnCtx)` Add to the index the information about a node.
    `LuceneQueryFactory` | `createLuceneQueryFactory(QueryContext context, org.hibernate.search.SearchFactory searchFactory)`
    `LuceneQuery` | `createQuery(SelectorName selectorName, List<Constraint> andedConstraints, LuceneProcessingContext processingContext)` Create a `LuceneQuery` for the supplied ANDed constraints of the ModeShape access query, which comes from the leaves of a query plan.
    `LuceneQueryEngine.TupleCollector` | `createTupleCollector(QueryContext queryContext, QueryResults.Columns columns)`
    `org.hibernate.search.indexes.impl.IndexManagerHolder` | `getAllIndexesManager()` Returns the global index manager.
    `boolean` | `initializedIndexes()` Retrieve whether the indexes were initialized and empty upon startup.
    `protected NodeInfo` | `nodeInfo(String id, String workspace, Path path, Name primaryType, Set<Name> mixinTypes, Iterator<Property> propertyIterator, NodeTypeSchemata schemata)`
    `void` | `removeAllFromIndex(String workspace, org.hibernate.search.backend.TransactionContext txnCtx)`
    `void` | `removeBinariesFromIndex(Iterable<String> sha1s, org.hibernate.search.backend.TransactionContext txnCtx)`
    `void` | `removeFromIndex(String workspace, Iterable<NodeKey> keys, org.hibernate.search.backend.TransactionContext txnCtx)`
    `void` | `shutdown()` Attempts to stop any active work items
    `protected String` | `stringFrom(Name name)`
    `protected String` | `stringFrom(Path path)`
    `void` | `updateIndex(String workspace, NodeKey key, Path path, Name primaryType, Set<Name> mixinTypes, Iterator<Property> properties, NodeTypeSchemata schemata, org.hibernate.search.backend.TransactionContext txnCtx)` Update the index to reflect the new state of the node.

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

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

- - ### Constructor Detail

    - #### BasicLuceneSchema

          public BasicLuceneSchema(ExecutionContext context,
                           org.hibernate.search.engine.spi.SearchFactoryImplementor searchFactory,
                           org.apache.lucene.util.Version version,
                           boolean enableFullTextSearch)

      Parameters:
        `context` - the execution context for the repository
        `searchFactory` - the search factory for accessing the indexes
        `version` - the Lucene version
        `enableFullTextSearch` - true if full-text searching is enabled, or false otherwise

  - ### Method Detail

    - #### shutdown

          public void shutdown()

      Attempts to stop any active work items

    - #### createLuceneQueryFactory

          public LuceneQueryFactory createLuceneQueryFactory(QueryContext context,
                                                    org.hibernate.search.SearchFactory searchFactory)

      Specified by:
        `createLuceneQueryFactory` in interface `LuceneSchema`

    - #### stringFrom

          protected final String stringFrom(Path path)

    - #### stringFrom

          protected final String stringFrom(Name name)

    - #### getAllIndexesManager

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

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

    - #### nodeInfo

          protected final NodeInfo nodeInfo(String id,
                          String workspace,
                          Path path,
                          Name primaryType,
                          Set<Name> mixinTypes,
                          Iterator<Property> propertyIterator,
                          NodeTypeSchemata schemata)

    - #### addDynamicField

          protected final DynamicField addDynamicField(String propertyName,
                                     Object value,
                                     DynamicField previous,
                                     org.apache.lucene.document.Field.Store stored,
                                     boolean fullTextSearchable,
                                     StringBuilder fullText)

      Create a dynamic field to store the property value.
      Parameters:
        `propertyName` - the name of the field in which the property value is to be stored; never null
        `value` - the property value; may be null
        `previous` - the previous DynamicField; may be null
        `stored` - true if the value is to be stored so it can be used in comparison criteria
        `fullTextSearchable` - true if this property value should be full-text searchable
        `fullText` - the node's full-text search text to which any full-text searchable terms should be added; will not be null if `fullTextSearchable` is `true`
      Returns:
        the new dynamic field, or the `previous` if none are created

    - #### addToIndex

          public void addToIndex(String workspace,
                        NodeKey key,
                        Path path,
                        Name primaryType,
                        Set<Name> mixinTypes,
                        Iterator<Property> propertiesIterator,
                        NodeTypeSchemata schemata,
                        org.hibernate.search.backend.TransactionContext txnCtx)

      Description copied from interface: `QueryIndexing`
      Add to the index the information about a node.
      Specified by:
        `addToIndex` in interface `QueryIndexing`
      Parameters:
        `workspace` - the workspace in which the node information should be available; may not be null
        `key` - the unique key for the node; may not be null
        `path` - the path of the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types for the node; may not be null but may be empty
        `propertiesIterator` - the iterator over the properties of a node; may not be null but may be empty
        `schemata` - the node type schemata that should be used to determine how the node is to be indexed; may not be null
        `txnCtx` - the transaction context in which the index updates should be made; may not be null

    - #### updateIndex

          public void updateIndex(String workspace,
                         NodeKey key,
                         Path path,
                         Name primaryType,
                         Set<Name> mixinTypes,
                         Iterator<Property> properties,
                         NodeTypeSchemata schemata,
                         org.hibernate.search.backend.TransactionContext txnCtx)

      Description copied from interface: `QueryIndexing`
      Update the index to reflect the new state of the node.
      Specified by:
        `updateIndex` in interface `QueryIndexing`
      Parameters:
        `workspace` - the workspace in which the node information should be available; may not be null
        `key` - the unique key for the node; may not be null
        `path` - the path of the node; may not be null
        `primaryType` - the primary type of the node; may not be null
        `mixinTypes` - the mixin types for the node; may not be null but may be empty
        `properties` - the properties of the node; may not be null but may be empty
        `schemata` - the node type schemata that should be used to determine how the node is to be indexed; may not be null
        `txnCtx` - the transaction context in which the index updates should be made; may not be null

    - #### removeFromIndex

          public void removeFromIndex(String workspace,
                             Iterable<NodeKey> keys,
                             org.hibernate.search.backend.TransactionContext txnCtx)

      Specified by:
        `removeFromIndex` in interface `QueryIndexing`

    - #### removeAllFromIndex

          public void removeAllFromIndex(String workspace,
                                org.hibernate.search.backend.TransactionContext txnCtx)

      Specified by:
        `removeAllFromIndex` in interface `QueryIndexing`

    - #### addBinaryToIndex

          public void addBinaryToIndex(Binary binary,
                              org.hibernate.search.backend.TransactionContext txnCtx)

      Specified by:
        `addBinaryToIndex` in interface `QueryIndexing`

    - #### removeBinariesFromIndex

          public void removeBinariesFromIndex(Iterable<String> sha1s,
                                     org.hibernate.search.backend.TransactionContext txnCtx)

      Specified by:
        `removeBinariesFromIndex` in interface `QueryIndexing`

    - #### createQuery

          public LuceneQuery createQuery(SelectorName selectorName,
                                List<Constraint> andedConstraints,
                                LuceneProcessingContext processingContext)
                                  throws LuceneException

      Description copied from interface: `LuceneSchema`
      Create a `LuceneQuery` for the supplied ANDed constraints of the ModeShape access query, which comes from the leaves of a query plan.
      Specified by:
        `createQuery` in interface `LuceneSchema`
      Parameters:
        `selectorName` - the name of the selector (or node type); never null
        `andedConstraints` - the constraints of the access query that are all ANDed together; never null
        `processingContext` - the processing context; never null
      Returns:
        the query that represents the Lucene Query object(s) to be executed; never null
      Throws:
        `LuceneException`

    - #### createTupleCollector

          public LuceneQueryEngine.TupleCollector createTupleCollector(QueryContext queryContext,
                                                              QueryResults.Columns columns)

      Specified by:
        `createTupleCollector` in interface `LuceneSchema`

    - #### initializedIndexes

          public boolean initializedIndexes()

      Description copied from interface: `QueryIndexing`
      Retrieve whether the indexes were initialized and empty upon startup.
      Specified by:
        `initializedIndexes` in interface `QueryIndexing`
      Returns:
        true if the index(es) initially had no content, or false if there was already at least some content in the indexes upon startup

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