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

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.JQOM2LuceneQueryBuilder
All Implemented Interfaces:
QueryObjectModelConstants, QOMTreeVisitor

public class JQOM2LuceneQueryBuilder
extends Object
implements QOMTreeVisitor, QueryObjectModelConstants

Implements a query builder that takes an JQOM and creates a lucene Query tree that can be executed on an index.


Field Summary
 
Fields inherited from interface org.apache.jackrabbit.spi.commons.query.jsr283.qom.QueryObjectModelConstants
JOIN_TYPE_INNER, JOIN_TYPE_LEFT_OUTER, JOIN_TYPE_RIGHT_OUTER, OPERATOR_EQUAL_TO, OPERATOR_GREATER_THAN, OPERATOR_GREATER_THAN_OR_EQUAL_TO, OPERATOR_LESS_THAN, OPERATOR_LESS_THAN_OR_EQUAL_TO, OPERATOR_LIKE, OPERATOR_NOT_EQUAL_TO, ORDER_ASCENDING, ORDER_DESCENDING
 
Method Summary
static org.apache.lucene.search.Query createQuery(QueryObjectModelTree qomTree, SessionImpl session, ItemStateManager sharedItemMgr, NamespaceMappings nsMappings, org.apache.lucene.analysis.Analyzer analyzer, PropertyTypeRegistry propReg, SynonymProvider synonymProvider, Map bindVariableValues, IndexFormatVersion version)
          Creates a lucene Query tree from an abstract query tree.
 Object visit(AndImpl node, Object data)
           
 Object visit(BindVariableValueImpl node, Object data)
           
 Object visit(ChildNodeImpl node, Object data)
           
 Object visit(ChildNodeJoinConditionImpl node, Object data)
           
 Object visit(ColumnImpl node, Object data)
           
 Object visit(ComparisonImpl node, Object data)
           
 Object visit(DescendantNodeImpl node, Object data)
           
 Object visit(DescendantNodeJoinConditionImpl node, Object data)
           
 Object visit(EquiJoinConditionImpl node, Object data)
           
 Object visit(FullTextSearchImpl node, Object data)
           
 Object visit(FullTextSearchScoreImpl node, Object data)
           
 Object visit(JoinImpl node, Object data)
           
 Object visit(LengthImpl node, Object data)
           
 Object visit(LiteralImpl node, Object data)
           
 Object visit(LowerCaseImpl node, Object data)
           
 Object visit(NodeLocalNameImpl node, Object data)
           
 Object visit(NodeNameImpl node, Object data)
           
 Object visit(NotImpl node, Object data)
           
 Object visit(OrderingImpl node, Object data)
           
 Object visit(OrImpl node, Object data)
           
 Object visit(PropertyExistenceImpl node, Object data)
           
 Object visit(PropertyValueImpl node, Object data)
           
 Object visit(QueryObjectModelTree node, Object data)
           
 Object visit(SameNodeImpl node, Object data)
           
 Object visit(SameNodeJoinConditionImpl node, Object data)
           
 Object visit(SelectorImpl node, Object data)
           
 Object visit(UpperCaseImpl node, Object data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createQuery

public static org.apache.lucene.search.Query createQuery(QueryObjectModelTree qomTree,
                                                         SessionImpl session,
                                                         ItemStateManager sharedItemMgr,
                                                         NamespaceMappings nsMappings,
                                                         org.apache.lucene.analysis.Analyzer analyzer,
                                                         PropertyTypeRegistry propReg,
                                                         SynonymProvider synonymProvider,
                                                         Map bindVariableValues,
                                                         IndexFormatVersion version)
                                                  throws RepositoryException
Creates a lucene Query tree from an abstract query tree.

Parameters:
qomTree - the root of the query object model.
session - of the user executing the query.
sharedItemMgr - the shared item state manager of the workspace.
nsMappings - namespace resolver for internal prefixes.
analyzer - for parsing the query statement of the contains function.
propReg - the property type registry to lookup type information.
synonymProvider - the synonym provider or null if node is configured.
bindVariableValues - the bind variable values.
version - the index format version.
Returns:
the lucene query tree.
Throws:
RepositoryException - if an error occurs during the translation.

visit

public Object visit(AndImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(BindVariableValueImpl node,
                    Object data)
             throws InvalidQueryException
Specified by:
visit in interface QOMTreeVisitor
Returns:
the Value for the passed bind variable value node.
Throws:
InvalidQueryException - if there is no value bound for the passed bind variable.

visit

public Object visit(ChildNodeImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(ChildNodeJoinConditionImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(ColumnImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(ComparisonImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(DescendantNodeImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(DescendantNodeJoinConditionImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(EquiJoinConditionImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(FullTextSearchImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(FullTextSearchScoreImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(JoinImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(LengthImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(LiteralImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor
Returns:
the Value of the literal node.

visit

public Object visit(LowerCaseImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(NodeLocalNameImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(NodeNameImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(NotImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(OrderingImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(OrImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(PropertyExistenceImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(PropertyValueImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(QueryObjectModelTree node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(SameNodeImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(SameNodeJoinConditionImpl node,
                    Object data)
Specified by:
visit in interface QOMTreeVisitor

visit

public Object visit(SelectorImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception

visit

public Object visit(UpperCaseImpl node,
                    Object data)
             throws Exception
Specified by:
visit in interface QOMTreeVisitor
Throws:
Exception


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