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.search.lucene
Class LuceneSearchSession

    java.lang.Object
      org.modeshape.search.lucene.LuceneSearchSession

All Implemented Interfaces:
  AbstractLuceneSearchEngine.WorkspaceSession

    @NotThreadSafe
    public class LuceneSearchSession

extends Object
implements AbstractLuceneSearchEngine.WorkspaceSession

The `AbstractLuceneSearchEngine.WorkspaceSession` implementation for the `LuceneSearchEngine`.

Nested Class Summary
`protected static class` | `LuceneSearchSession.DualIndexTupleCollector` This collector is responsible for loading the value for each of the columns into each tuple array.
`protected static class` | `LuceneSearchSession.FullTextSearchTupleCollector` This collector is responsible for loading the value for each of the columns into each tuple array.

Field Summary
`protected static org.apache.lucene.document.FieldSelector` | `LOCATION_FIELDS_SELECTOR` An immutable `FieldSelector` instance that accesses the UUID field.
`protected static int` | `MAX_DEPTH`
`protected static int` | `MAX_SNS_INDEX`
`protected static int` | `MIN_DEPTH`
`protected static int` | `MIN_SNS_INDEX`
`protected static Set<Name>` | `NON_SEARCHABLE_NAMES`
`protected LuceneSearchProcessor` | `processor`

Constructor Summary
`protected` | `LuceneSearchSession(LuceneSearchWorkspace workspace, LuceneSearchProcessor processor)`

Method Summary
`void` | `commit()` Subclasses should implement this method to commit and save any work that has been done with this processor.
`protected org.apache.lucene.search.Query` | `createLocalNameQuery(String likeExpression, CaseOperations.CaseOperation caseOperation)`
`protected org.apache.lucene.search.Query` | `createSnsIndexQuery(String likeExpression)` Utility method to generate a query against the SNS indexes.
`AbstractLuceneSearchEngine.TupleCollector` | `createTupleCollector(QueryResults.Columns columns)` Create a `AbstractLuceneSearchEngine.TupleCollector` instance that collects the results from the index(es).
`org.apache.lucene.search.Query` | `findAllNodesAtOrBelow(Path parentPath)`
`org.apache.lucene.search.Query` | `findAllNodesBelow(Path parentPath)`
`org.apache.lucene.search.Query` | `findAllNodesBelow(Path parentPath, int maximumDepth)`
`org.apache.lucene.search.Query` | `findChildNodes(Path parentPath)` Return a query that can be used to find all of the documents that represent nodes that are children of the node at the supplied path.
`org.apache.lucene.search.Query` | `findNodeAt(Path path)` Create a query that can be used to find the one document (or node) that exists at the exact path supplied.
`org.apache.lucene.search.Query` | `findNodesLike(String fieldName, String likeExpression, CaseOperations.CaseOperation caseOperation)` Create a query that can be used to find documents (or nodes) that have a field value that satisfies the supplied LIKE expression.
`org.apache.lucene.search.Query` | `findNodesWith(Length propertyLength, Operator operator, Object value)`
`org.apache.lucene.search.Query` | `findNodesWith(NodeDepth depthConstraint, Operator operator, Object value)`
`org.apache.lucene.search.Query` | `findNodesWith(NodeLocalName nodeName, Operator operator, Object value, CaseOperations.CaseOperation caseOperation)`
`org.apache.lucene.search.Query` | `findNodesWith(NodeName nodeName, Operator operator, Object value, CaseOperations.CaseOperation caseOperation)`
`org.apache.lucene.search.Query` | `findNodesWith(NodePath nodePath, Operator operator, Object value, CaseOperations.CaseOperation caseOperation)`
`org.apache.lucene.search.Query` | `findNodesWith(PropertyValue propertyValue, Operator operator, Object value, CaseOperations.CaseOperation caseOperation)`
`org.apache.lucene.search.Query` | `findNodesWith(ReferenceValue referenceValue, Operator operator, Object value)`
`org.apache.lucene.search.Query` | `findNodesWithNumericRange(NodeDepth depth, Object lowerValue, Object upperValue, boolean includesLower, boolean includesUpper)`
`org.apache.lucene.search.Query` | `findNodesWithNumericRange(PropertyValue propertyValue, Object lowerValue, Object upperValue, boolean includesLower, boolean includesUpper)`
`protected org.apache.lucene.search.Query` | `findNodesWithNumericRange(String field, Object lowerValue, Object upperValue, boolean includesLower, boolean includesUpper)`
`org.apache.lucene.analysis.Analyzer` | `getAnalyzer()`
`int` | `getChangeCount()` Get the number of changes that have been made to the workspace using this session.
`protected org.apache.lucene.index.IndexReader` | `getContentReader()`
`org.apache.lucene.search.IndexSearcher` | `getContentSearcher()`
`protected org.apache.lucene.index.IndexWriter` | `getContentWriter()`
`Location` | `getLocationForRoot()`
`org.apache.lucene.util.Version` | `getVersion()`
`LuceneSearchWorkspace` | `getWorkspace()`
`String` | `getWorkspaceName()`
`boolean` | `hasWriters()`
`protected String` | `likeExpresionForWildcardPath(String path)`
`protected org.apache.lucene.search.Query` | `not(org.apache.lucene.search.Query notted)`
`protected Location` | `readLocation(org.apache.lucene.document.Document doc)`
`protected void` | `recordChange()`
`protected void` | `recordChanges(int numberOfChanges)`
`void` | `rollback()` Subclasses should implement this method to throw away any work that has been done with this processor.
`protected QueryResults.Statistics` | `search(String fullTextSearchExpression, List<Object[]> results, int maxRows, int offset)`
`protected void` | `setOrReplaceProperties(Location location, Iterable<Property> properties)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NON_SEARCHABLE_NAMES

    protected static final Set<Name> NON_SEARCHABLE_NAMES

### LOCATION_FIELDS_SELECTOR

    protected static final org.apache.lucene.document.FieldSelector LOCATION_FIELDS_SELECTOR

  An immutable `FieldSelector` instance that accesses the UUID field.

### MIN_DEPTH

    protected static final int MIN_DEPTH

See Also:
  Constant Field Values

### MAX_DEPTH

    protected static final int MAX_DEPTH

See Also:
  Constant Field Values

### MIN_SNS_INDEX

    protected static final int MIN_SNS_INDEX

See Also:
  Constant Field Values

### MAX_SNS_INDEX

    protected static final int MAX_SNS_INDEX

See Also:
  Constant Field Values

### processor

    protected final LuceneSearchProcessor processor

Constructor Detail

### LuceneSearchSession

    protected LuceneSearchSession(LuceneSearchWorkspace workspace,
                                  LuceneSearchProcessor processor)

Method Detail

### getWorkspaceName

    public String getWorkspaceName()

  Specified by:
    `getWorkspaceName` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  See Also:
    `AbstractLuceneSearchEngine.WorkspaceSession.getWorkspaceName()`

### getWorkspace

    public LuceneSearchWorkspace getWorkspace()

  Returns:
    workspace

### getContentReader

    protected org.apache.lucene.index.IndexReader getContentReader()
                                                            throws IOException

  Throws:
    `IOException`

### getContentWriter

    protected org.apache.lucene.index.IndexWriter getContentWriter()
                                                            throws IOException

  Throws:
    `IOException`

### getContentSearcher

    public org.apache.lucene.search.IndexSearcher getContentSearcher()
                                                              throws IOException

  Specified by:
    `getContentSearcher` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  Throws:
    `IOException`

### getAnalyzer

    public org.apache.lucene.analysis.Analyzer getAnalyzer()

  Specified by:
    `getAnalyzer` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  See Also:
    `AbstractLuceneSearchEngine.WorkspaceSession.getAnalyzer()`

### getVersion

    public org.apache.lucene.util.Version getVersion()

  Specified by:
    `getVersion` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  See Also:
    `AbstractLuceneSearchEngine.WorkspaceSession.getVersion()`

### hasWriters

    public boolean hasWriters()

  Specified by:
    `hasWriters` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### recordChange

    protected final void recordChange()

### recordChanges

    protected final void recordChanges(int numberOfChanges)

### getChangeCount

    public final int getChangeCount()

  Get the number of changes that have been made to the workspace using this session.

  Specified by:
    `getChangeCount` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  Returns:
    the number of changes; never negative
  See Also:
    `AbstractLuceneSearchEngine.WorkspaceSession.getChangeCount()`

### commit

    public void commit()

  Subclasses should implement this method to commit and save any work that has been done with this processor.

  Specified by:
    `commit` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  See Also:
    `AbstractLuceneSearchEngine.WorkspaceSession.commit()`

### rollback

    public void rollback()

  Subclasses should implement this method to throw away any work that has been done with this processor.

  Specified by:
    `rollback` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  See Also:
    `AbstractLuceneSearchEngine.WorkspaceSession.rollback()`

### search

    protected QueryResults.Statistics search(String fullTextSearchExpression,
                                             List<Object[]> results,
                                             int maxRows,
                                             int offset)
                                      throws org.apache.lucene.queryParser.ParseException,
                                             IOException

  Throws:
    `org.apache.lucene.queryParser.ParseException`
    `IOException`

### readLocation

    protected Location readLocation(org.apache.lucene.document.Document doc)

### setOrReplaceProperties

    protected void setOrReplaceProperties(Location location,
                                          Iterable<Property> properties)
                                   throws IOException

  Throws:
    `IOException`

### createTupleCollector

    public AbstractLuceneSearchEngine.TupleCollector createTupleCollector(QueryResults.Columns columns)

  Create a `AbstractLuceneSearchEngine.TupleCollector` instance that collects the results from the index(es).

  Specified by:
    `createTupleCollector` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  Parameters:
    `columns` - the column definitions; never null
  Returns:
    the collector; never null
  See Also:
    `AbstractLuceneSearchEngine.WorkspaceSession.createTupleCollector(org.modeshape.graph.query.QueryResults.Columns)`

### getLocationForRoot

    public Location getLocationForRoot()
                                throws IOException

  Throws:
    `IOException`

### findAllNodesBelow

    public org.apache.lucene.search.Query findAllNodesBelow(Path parentPath)

  Specified by:
    `findAllNodesBelow` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### findAllNodesBelow

    public org.apache.lucene.search.Query findAllNodesBelow(Path parentPath,
                                                            int maximumDepth)

### findAllNodesAtOrBelow

    public org.apache.lucene.search.Query findAllNodesAtOrBelow(Path parentPath)

  Specified by:
    `findAllNodesAtOrBelow` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### findChildNodes

    public org.apache.lucene.search.Query findChildNodes(Path parentPath)

  Return a query that can be used to find all of the documents that represent nodes that are children of the node at the supplied path.

  Specified by:
    `findChildNodes` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  Parameters:
    `parentPath` - the path of the parent node.
  Returns:
    the query; never null

### findNodeAt

    public org.apache.lucene.search.Query findNodeAt(Path path)

  Create a query that can be used to find the one document (or node) that exists at the exact path supplied.

  Specified by:
    `findNodeAt` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  Parameters:
    `path` - the path of the node
  Returns:
    the query; never null

### findNodesLike

    public org.apache.lucene.search.Query findNodesLike(String fieldName,
                                                        String likeExpression,
                                                        CaseOperations.CaseOperation caseOperation)

  Description copied from interface: `AbstractLuceneSearchEngine.WorkspaceSession`
  Create a query that can be used to find documents (or nodes) that have a field value that satisfies the supplied LIKE expression.

  Specified by:
    `findNodesLike` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  Parameters:
    `fieldName` - the name of the document field to search
    `likeExpression` - the JCR like expression
    `caseOperation` - the operation that should be used upon the stored indexed value before comparing the supplied value
  Returns:
    the query; never null

### findNodesWith

    public org.apache.lucene.search.Query findNodesWith(Length propertyLength,
                                                        Operator operator,
                                                        Object value)

  Specified by:
    `findNodesWith` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### findNodesWith

    public org.apache.lucene.search.Query findNodesWith(PropertyValue propertyValue,
                                                        Operator operator,
                                                        Object value,
                                                        CaseOperations.CaseOperation caseOperation)

  Specified by:
    `findNodesWith` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### findNodesWith

    public org.apache.lucene.search.Query findNodesWith(ReferenceValue referenceValue,
                                                        Operator operator,
                                                        Object value)

  Specified by:
    `findNodesWith` in interface `AbstractLuceneSearchEngine.WorkspaceSession`
  See Also:
    `AbstractLuceneSearchEngine.WorkspaceSession.findNodesWith(org.modeshape.graph.query.model.ReferenceValue, org.modeshape.graph.query.model.Operator, java.lang.Object)`

### findNodesWithNumericRange

    public org.apache.lucene.search.Query findNodesWithNumericRange(PropertyValue propertyValue,
                                                                    Object lowerValue,
                                                                    Object upperValue,
                                                                    boolean includesLower,
                                                                    boolean includesUpper)

  Specified by:
    `findNodesWithNumericRange` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### findNodesWithNumericRange

    public org.apache.lucene.search.Query findNodesWithNumericRange(NodeDepth depth,
                                                                    Object lowerValue,
                                                                    Object upperValue,
                                                                    boolean includesLower,
                                                                    boolean includesUpper)

  Specified by:
    `findNodesWithNumericRange` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### findNodesWithNumericRange

    protected org.apache.lucene.search.Query findNodesWithNumericRange(String field,
                                                                       Object lowerValue,
                                                                       Object upperValue,
                                                                       boolean includesLower,
                                                                       boolean includesUpper)

### likeExpresionForWildcardPath

    protected String likeExpresionForWildcardPath(String path)

### findNodesWith

    public org.apache.lucene.search.Query findNodesWith(NodePath nodePath,
                                                        Operator operator,
                                                        Object value,
                                                        CaseOperations.CaseOperation caseOperation)

  Specified by:
    `findNodesWith` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### not

    protected org.apache.lucene.search.Query not(org.apache.lucene.search.Query notted)

### findNodesWith

    public org.apache.lucene.search.Query findNodesWith(NodeName nodeName,
                                                        Operator operator,
                                                        Object value,
                                                        CaseOperations.CaseOperation caseOperation)

  Specified by:
    `findNodesWith` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### findNodesWith

    public org.apache.lucene.search.Query findNodesWith(NodeLocalName nodeName,
                                                        Operator operator,
                                                        Object value,
                                                        CaseOperations.CaseOperation caseOperation)

  Specified by:
    `findNodesWith` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### findNodesWith

    public org.apache.lucene.search.Query findNodesWith(NodeDepth depthConstraint,
                                                        Operator operator,
                                                        Object value)

  Specified by:
    `findNodesWith` in interface `AbstractLuceneSearchEngine.WorkspaceSession`

### createLocalNameQuery

    protected org.apache.lucene.search.Query createLocalNameQuery(String likeExpression,
                                                                  CaseOperations.CaseOperation caseOperation)

### createSnsIndexQuery

    protected org.apache.lucene.search.Query createSnsIndexQuery(String likeExpression)

  Utility method to generate a query against the SNS indexes. This method attempts to generate a query that works most efficiently, depending upon the supplied expression. For example, if the supplied expression is just "[3]", then a range query is used to find all values matching '3'. However, if "[3_]" is used (where '_' matches any single-character, or digit in this case), then a range query is used to find all values between '30' and '39'. Similarly, if "[3%]" is used, then a regular expression query is used.

  Parameters:
    `likeExpression` - the expression that uses the JCR 2.0 LIKE representation, and which includes the leading '[' and trailing ']' characters
  Returns:
    the query, or null if the expression cannot be represented as a query

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.