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

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.LuceneQueryBuilder
All Implemented Interfaces:
QueryNodeVisitor

public class LuceneQueryBuilder
extends Object
implements QueryNodeVisitor

Implements a query builder that takes an abstract query tree and creates a lucene Query tree that can be executed on an index. todo introduce a node type hierarchy for efficient translation of NodeTypeQueryNode


Method Summary
 org.apache.lucene.search.Query createPredicateDeref(org.apache.lucene.search.Query subQuery, DerefQueryNode node, Object data)
           
static org.apache.lucene.search.Query createQuery(QueryRootNode root, SessionImpl session, ItemStateManager sharedItemMgr, NamespaceMappings nsMappings, org.apache.lucene.analysis.Analyzer analyzer, PropertyTypeRegistry propReg, SynonymProvider synonymProvider, IndexFormatVersion indexFormatVersion)
          Creates a lucene Query tree from an abstract query tree.
 Object visit(AndQueryNode node, Object data)
           
 Object visit(DerefQueryNode node, Object data)
           
 Object visit(ExactQueryNode node, Object data)
           
 Object visit(LocationStepQueryNode node, Object data)
           
 Object visit(NodeTypeQueryNode node, Object data)
           
 Object visit(NotQueryNode node, Object data)
           
 Object visit(OrderQueryNode node, Object data)
           
 Object visit(OrQueryNode node, Object data)
           
 Object visit(PathQueryNode node, Object data)
           
 Object visit(PropertyFunctionQueryNode node, Object data)
           
 Object visit(QueryRootNode node, Object data)
           
 Object visit(RelationQueryNode node, Object data)
           
 Object visit(TextsearchQueryNode 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(QueryRootNode root,
                                                         SessionImpl session,
                                                         ItemStateManager sharedItemMgr,
                                                         NamespaceMappings nsMappings,
                                                         org.apache.lucene.analysis.Analyzer analyzer,
                                                         PropertyTypeRegistry propReg,
                                                         SynonymProvider synonymProvider,
                                                         IndexFormatVersion indexFormatVersion)
                                                  throws RepositoryException
Creates a lucene Query tree from an abstract query tree.

Parameters:
root - the root node of the abstract query tree.
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.
indexFormatVersion - the index format version to be used
Returns:
the lucene query tree.
Throws:
RepositoryException - if an error occurs during the translation.

visit

public Object visit(QueryRootNode node,
                    Object data)
             throws RepositoryException
Specified by:
visit in interface QueryNodeVisitor
Throws:
RepositoryException

visit

public Object visit(OrQueryNode node,
                    Object data)
             throws RepositoryException
Specified by:
visit in interface QueryNodeVisitor
Throws:
RepositoryException

visit

public Object visit(AndQueryNode node,
                    Object data)
             throws RepositoryException
Specified by:
visit in interface QueryNodeVisitor
Throws:
RepositoryException

visit

public Object visit(NotQueryNode node,
                    Object data)
             throws RepositoryException
Specified by:
visit in interface QueryNodeVisitor
Throws:
RepositoryException

visit

public Object visit(ExactQueryNode node,
                    Object data)
Specified by:
visit in interface QueryNodeVisitor

visit

public Object visit(NodeTypeQueryNode node,
                    Object data)
Specified by:
visit in interface QueryNodeVisitor

visit

public Object visit(TextsearchQueryNode node,
                    Object data)
Specified by:
visit in interface QueryNodeVisitor

visit

public Object visit(PathQueryNode node,
                    Object data)
             throws RepositoryException
Specified by:
visit in interface QueryNodeVisitor
Throws:
RepositoryException

visit

public Object visit(LocationStepQueryNode node,
                    Object data)
             throws RepositoryException
Specified by:
visit in interface QueryNodeVisitor
Throws:
RepositoryException

visit

public Object visit(DerefQueryNode node,
                    Object data)
             throws RepositoryException
Specified by:
visit in interface QueryNodeVisitor
Throws:
RepositoryException

visit

public Object visit(RelationQueryNode node,
                    Object data)
             throws RepositoryException
Specified by:
visit in interface QueryNodeVisitor
Throws:
RepositoryException

createPredicateDeref

public org.apache.lucene.search.Query createPredicateDeref(org.apache.lucene.search.Query subQuery,
                                                           DerefQueryNode node,
                                                           Object data)
                                                    throws RepositoryException
Throws:
RepositoryException

visit

public Object visit(OrderQueryNode node,
                    Object data)
Specified by:
visit in interface QueryNodeVisitor

visit

public Object visit(PropertyFunctionQueryNode node,
                    Object data)
Specified by:
visit in interface QueryNodeVisitor


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