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

java.lang.Object
  extended byorg.apache.jackrabbit.core.query.lucene.QueryImpl
All Implemented Interfaces:
ExecutableQuery

public class QueryImpl
extends Object
implements ExecutableQuery

Implements the ExecutableQuery interface.


Field Summary
protected static QueryRootNode ALL_NODES
          Represents a query that selects all nodes.
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  QueryRootNode root
          The root node of the query tree
protected  SessionImpl session
          The session of the user executing this query
 
Constructor Summary
QueryImpl(SessionImpl session, ItemManager itemMgr, SearchIndex index, PropertyTypeRegistry propReg, String statement, String language)
          Creates a new query instance from a query string.
 
Method Summary
 QueryResult execute()
          Executes this query and returns a QueryResult.
 boolean getRespectDocumentOrder()
          If set true the result nodes will be in document order per default (if no order by clause is specified).
protected  QName[] getSelectProperties()
          Returns the select properties for this query.
 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
 

Field Detail

ALL_NODES

protected static final QueryRootNode ALL_NODES
Represents a query that selects all nodes. E.g. in XPath: //*


root

protected final QueryRootNode root
The root node of the query tree


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

QueryImpl

public QueryImpl(SessionImpl session,
                 ItemManager itemMgr,
                 SearchIndex index,
                 PropertyTypeRegistry propReg,
                 String statement,
                 String language)
          throws InvalidQueryException
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.
statement - the query statement.
language - the syntax of the query statement.
Throws:
InvalidQueryException - if the query statement is invalid according to the specified language.
Method Detail

execute

public QueryResult execute()
                    throws RepositoryException
Executes this query and returns a QueryResult.

Specified by:
execute in interface ExecutableQuery
Returns:
a QueryResult
Throws:
RepositoryException - if an error occurs

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()

getSelectProperties

protected QName[] getSelectProperties()
                               throws RepositoryException
Returns the select properties for this query.

Returns:
array of select property names.
Throws:
RepositoryException - if an error occurs.


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