Class LuceneQueryBuilder

  • All Implemented Interfaces:
    org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor

    public class LuceneQueryBuilder
    extends Object
    implements org.apache.jackrabbit.spi.commons.query.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 Detail

      • createQuery

        public static org.apache.lucene.search.Query createQuery​(org.apache.jackrabbit.spi.commons.query.QueryRootNode root,
                                                                 SessionImpl session,
                                                                 ItemStateManager sharedItemMgr,
                                                                 NamespaceMappings nsMappings,
                                                                 org.apache.lucene.analysis.Analyzer analyzer,
                                                                 PropertyTypeRegistry propReg,
                                                                 SynonymProvider synonymProvider,
                                                                 IndexFormatVersion indexFormatVersion,
                                                                 org.apache.jackrabbit.core.query.lucene.PerQueryCache cache)
                                                          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​(org.apache.jackrabbit.spi.commons.query.QueryRootNode node,
                            Object data)
                     throws RepositoryException
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
        Throws:
        RepositoryException
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.OrQueryNode node,
                            Object data)
                     throws RepositoryException
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
        Throws:
        RepositoryException
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.AndQueryNode node,
                            Object data)
                     throws RepositoryException
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
        Throws:
        RepositoryException
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.NotQueryNode node,
                            Object data)
                     throws RepositoryException
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
        Throws:
        RepositoryException
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.ExactQueryNode node,
                            Object data)
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.NodeTypeQueryNode node,
                            Object data)
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.TextsearchQueryNode node,
                            Object data)
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.PathQueryNode node,
                            Object data)
                     throws RepositoryException
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
        Throws:
        RepositoryException
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.LocationStepQueryNode node,
                            Object data)
                     throws RepositoryException
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
        Throws:
        RepositoryException
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.DerefQueryNode node,
                            Object data)
                     throws RepositoryException
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
        Throws:
        RepositoryException
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.RelationQueryNode node,
                            Object data)
                     throws RepositoryException
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
        Throws:
        RepositoryException
      • createPredicateDeref

        public org.apache.lucene.search.Query createPredicateDeref​(org.apache.lucene.search.Query subQuery,
                                                                   org.apache.jackrabbit.spi.commons.query.DerefQueryNode node,
                                                                   Object data)
                                                            throws RepositoryException
        Throws:
        RepositoryException
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.OrderQueryNode node,
                            Object data)
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor
      • visit

        public Object visit​(org.apache.jackrabbit.spi.commons.query.PropertyFunctionQueryNode node,
                            Object data)
        Specified by:
        visit in interface org.apache.jackrabbit.spi.commons.query.QueryNodeVisitor