org.apache.jackrabbit.core.query.lucene
Class AbstractQueryImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.AbstractQueryImpl
All Implemented Interfaces:
ExecutableQuery
Direct Known Subclasses:
QueryImpl, QueryObjectModelImpl

public abstract class AbstractQueryImpl
extends Object
implements ExecutableQuery

AbstractQueryImpl provides a base class for executable queries based on SearchIndex.


Field Summary
protected  SearchIndex index
          The actual search index
protected  ItemManager itemMgr
          The item manager of the user executing this query
protected  PropertyTypeRegistry propReg
          The property type registry for type lookup.
protected  SessionImpl session
          The session of the user executing this query
 
Constructor Summary
AbstractQueryImpl(SessionImpl session, ItemManager itemMgr, SearchIndex index, PropertyTypeRegistry propReg)
          Creates a new query instance from a query string.
 
Method Summary
protected  void addVariableName(Name varName)
          Adds a name to the set of variables.
 void bindValue(Name varName, Value value)
          Binds the given value to the variable named varName.
 Name[] getBindVariableNames()
          
protected  Map<Name,Value> getBindVariableValues()
           
protected  QueryObjectModelFactory getQOMFactory()
           
 boolean getRespectDocumentOrder()
          If set true the result nodes will be in document order per default (if no order by clause is specified).
abstract  boolean needsSystemTree()
          Returns true if this query node needs items under /jcr:system to be queried.
 void setRespectDocumentOrder(boolean documentOrder)
          Sets a new value for this property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jackrabbit.core.query.ExecutableQuery
execute
 

Field Detail

session

protected final SessionImpl session
The session of the user executing this query


itemMgr

protected final ItemManager itemMgr
The item manager of the user executing this query


index

protected final SearchIndex index
The actual search index


propReg

protected final PropertyTypeRegistry propReg
The property type registry for type lookup.

Constructor Detail

AbstractQueryImpl

public AbstractQueryImpl(SessionImpl session,
                         ItemManager itemMgr,
                         SearchIndex index,
                         PropertyTypeRegistry propReg)
Creates a new query instance from a query string.

Parameters:
session - the session of the user executing this query.
itemMgr - the item manager of the session executing this query.
index - the search index.
propReg - the property type registry.
Method Detail

getRespectDocumentOrder

public boolean getRespectDocumentOrder()
If set true the result nodes will be in document order per default (if no order by clause is specified). If set to false the result nodes are returned in whatever sequence the index has stored the nodes. That sequence is stable over multiple invocations of the same query, but will change when nodes get added or removed from the index.

The default value for this property is true.

Returns:
the current value of this property.

setRespectDocumentOrder

public void setRespectDocumentOrder(boolean documentOrder)
Sets a new value for this property.

Parameters:
documentOrder - if true the result nodes are in document order per default.
See Also:
getRespectDocumentOrder()

bindValue

public void bindValue(Name varName,
                      Value value)
               throws IllegalArgumentException,
                      RepositoryException
Binds the given value to the variable named varName.

Specified by:
bindValue in interface ExecutableQuery
Parameters:
varName - name of variable in query
value - value to bind
Throws:
IllegalArgumentException - if varName is not a valid variable in this query.
RepositoryException - if an error occurs.

getBindVariableNames

public Name[] getBindVariableNames()
                            throws RepositoryException

Specified by:
getBindVariableNames in interface ExecutableQuery
Returns:
the names of the bind variables in this query.
Throws:
RepositoryException - if an error occurs.

addVariableName

protected void addVariableName(Name varName)
Adds a name to the set of variables.

Parameters:
varName - the name of the variable.

getBindVariableValues

protected Map<Name,Value> getBindVariableValues()
Returns:
an unmodifieable map, which contains the variable names and their respective value.

getQOMFactory

protected QueryObjectModelFactory getQOMFactory()
                                         throws RepositoryException
Returns:
the query object model factory.
Throws:
RepositoryException - if an error occurs.

needsSystemTree

public abstract boolean needsSystemTree()
Returns true if this query node needs items under /jcr:system to be queried.

Returns:
true if this query node needs content under /jcr:system to be queried; false otherwise.


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.