ModeShape Distribution 3.0.0.Beta4

org.modeshape.jcr.query.lucene.basic
Class BasicLuceneSchema

java.lang.Object
  extended by 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
BasicLuceneSchema(ExecutionContext context, org.hibernate.search.engine.spi.SearchFactoryImplementor searchFactory, org.apache.lucene.util.Version version, boolean enableFullTextSearch)
           
 
Method Summary
 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, Collection<Property> properties, 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)
           
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()
           
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()

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)

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,
                       Collection<Property> properties,
                       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
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

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

ModeShape Distribution 3.0.0.Beta4

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