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

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.LuceneQueryFactory

public class LuceneQueryFactory
extends Object

Factory that creates Lucene queries from QOM elements.


Nested Class Summary
protected  class LuceneQueryFactory.QueryPair
           
protected static class LuceneQueryFactory.Transform
           
 
Constructor Summary
LuceneQueryFactory(SessionImpl session, SearchIndex index, Map<String,Value> bindVariables)
          Creates a new lucene query factory.
 
Method Summary
protected  void addBooleanConstraint(org.apache.lucene.search.BooleanQuery query, Constraint constraint, org.apache.lucene.search.BooleanClause.Occur occur, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher)
           
protected  org.apache.lucene.search.Query create(Constraint constraint, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher)
           
 org.apache.lucene.search.Query create(FullTextSearchImpl fts)
          Creates a lucene query for the given QOM full text search.
 org.apache.lucene.search.Query create(PropertyExistenceImpl prop)
          Creates a lucene query for the given QOM property existence constraint.
 org.apache.lucene.search.Query create(Selector selector)
          Creates a lucene query for the given QOM selector.
protected  org.apache.lucene.index.Term createNodeTypeTerm(NodeType type)
           
 List<Row> execute(Map<String,PropertyValue> columns, Selector selector, Constraint constraint)
           
protected  org.apache.lucene.search.BooleanQuery getAndQuery(And and, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher)
           
protected  org.apache.lucene.search.Query getComparisonQuery(DynamicOperand left, int transform, String operator, StaticOperand rigth, Map<String,NodeType> selectorMap)
           
protected  org.apache.lucene.search.Query getDescendantNodeQuery(DescendantNode dn, JackrabbitIndexSearcher searcher)
           
protected  org.apache.lucene.search.Query getFullTextSearchQuery(FullTextSearch fts)
           
protected  org.apache.lucene.search.Query getNodeIdQuery(String field, String path)
           
protected  org.apache.lucene.search.Query getNodeLocalNameQuery(int transform, String operator, StaticOperand right)
           
protected  org.apache.lucene.search.Query getNodeNameQuery(int transform, String operator, StaticOperand right)
           
protected  org.apache.jackrabbit.core.query.lucene.NotQuery getNotQuery(Not not, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher)
           
protected  org.apache.lucene.search.BooleanQuery getOrQuery(Or or, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher)
           
protected  org.apache.lucene.search.Query getPropertyExistenceQuery(PropertyExistence property)
           
protected  org.apache.lucene.search.Query getPropertyValueQuery(String field, String operator, Value value, int type, int transform)
           
protected  org.apache.lucene.index.Term getTerm(String field, String value)
           
protected  String getValueString(Value value, int type)
           
protected  Predicate mapConstraintToQueryAndFilter(LuceneQueryFactory.QueryPair query, Constraint constraint, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher, org.apache.lucene.index.IndexReader reader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneQueryFactory

public LuceneQueryFactory(SessionImpl session,
                          SearchIndex index,
                          Map<String,Value> bindVariables)
                   throws RepositoryException
Creates a new lucene query factory.

Parameters:
session - the session that executes the query.
index - the search index
bindVariables - the bind variable values of the query
Throws:
RepositoryException
Method Detail

execute

public List<Row> execute(Map<String,PropertyValue> columns,
                         Selector selector,
                         Constraint constraint)
                  throws RepositoryException,
                         IOException
Throws:
RepositoryException
IOException

create

public org.apache.lucene.search.Query create(Selector selector)
                                      throws RepositoryException
Creates a lucene query for the given QOM selector.

Parameters:
selector - the selector.
Returns:
a lucene query for the given selector.
Throws:
RepositoryException - if an error occurs while creating the query.

createNodeTypeTerm

protected org.apache.lucene.index.Term createNodeTypeTerm(NodeType type)
                                                   throws RepositoryException
Throws:
RepositoryException

create

public org.apache.lucene.search.Query create(FullTextSearchImpl fts)
                                      throws RepositoryException
Creates a lucene query for the given QOM full text search.

Parameters:
constraint - the full text search constraint.
Returns:
the lucene query for the given constraint.
Throws:
RepositoryException - if an error occurs while creating the query.

create

public org.apache.lucene.search.Query create(PropertyExistenceImpl prop)
                                      throws RepositoryException
Creates a lucene query for the given QOM property existence constraint.

Parameters:
constraint - the QOM constraint.
Returns:
the lucene query for the given constraint.
Throws:
RepositoryException - if an error occurs while creating the query.

mapConstraintToQueryAndFilter

protected Predicate mapConstraintToQueryAndFilter(LuceneQueryFactory.QueryPair query,
                                                  Constraint constraint,
                                                  Map<String,NodeType> selectorMap,
                                                  JackrabbitIndexSearcher searcher,
                                                  org.apache.lucene.index.IndexReader reader)
                                           throws RepositoryException,
                                                  IOException
Throws:
RepositoryException
IOException

create

protected org.apache.lucene.search.Query create(Constraint constraint,
                                                Map<String,NodeType> selectorMap,
                                                JackrabbitIndexSearcher searcher)
                                         throws RepositoryException,
                                                IOException
Throws:
RepositoryException
IOException

getDescendantNodeQuery

protected org.apache.lucene.search.Query getDescendantNodeQuery(DescendantNode dn,
                                                                JackrabbitIndexSearcher searcher)
                                                         throws RepositoryException,
                                                                IOException
Throws:
RepositoryException
IOException

getFullTextSearchQuery

protected org.apache.lucene.search.Query getFullTextSearchQuery(FullTextSearch fts)
                                                         throws RepositoryException
Throws:
RepositoryException

getAndQuery

protected org.apache.lucene.search.BooleanQuery getAndQuery(And and,
                                                            Map<String,NodeType> selectorMap,
                                                            JackrabbitIndexSearcher searcher)
                                                     throws RepositoryException,
                                                            IOException
Throws:
RepositoryException
IOException

getOrQuery

protected org.apache.lucene.search.BooleanQuery getOrQuery(Or or,
                                                           Map<String,NodeType> selectorMap,
                                                           JackrabbitIndexSearcher searcher)
                                                    throws RepositoryException,
                                                           IOException
Throws:
RepositoryException
IOException

addBooleanConstraint

protected void addBooleanConstraint(org.apache.lucene.search.BooleanQuery query,
                                    Constraint constraint,
                                    org.apache.lucene.search.BooleanClause.Occur occur,
                                    Map<String,NodeType> selectorMap,
                                    JackrabbitIndexSearcher searcher)
                             throws RepositoryException,
                                    IOException
Throws:
RepositoryException
IOException

getNotQuery

protected org.apache.jackrabbit.core.query.lucene.NotQuery getNotQuery(Not not,
                                                                       Map<String,NodeType> selectorMap,
                                                                       JackrabbitIndexSearcher searcher)
                                                                throws RepositoryException,
                                                                       IOException
Throws:
RepositoryException
IOException

getPropertyExistenceQuery

protected org.apache.lucene.search.Query getPropertyExistenceQuery(PropertyExistence property)
                                                            throws RepositoryException
Throws:
RepositoryException

getComparisonQuery

protected org.apache.lucene.search.Query getComparisonQuery(DynamicOperand left,
                                                            int transform,
                                                            String operator,
                                                            StaticOperand rigth,
                                                            Map<String,NodeType> selectorMap)
                                                     throws RepositoryException
Throws:
RepositoryException

getNodeNameQuery

protected org.apache.lucene.search.Query getNodeNameQuery(int transform,
                                                          String operator,
                                                          StaticOperand right)
                                                   throws RepositoryException
Throws:
RepositoryException

getNodeLocalNameQuery

protected org.apache.lucene.search.Query getNodeLocalNameQuery(int transform,
                                                               String operator,
                                                               StaticOperand right)
                                                        throws RepositoryException
Throws:
RepositoryException

getNodeIdQuery

protected org.apache.lucene.search.Query getNodeIdQuery(String field,
                                                        String path)
                                                 throws RepositoryException
Throws:
RepositoryException

getPropertyValueQuery

protected org.apache.lucene.search.Query getPropertyValueQuery(String field,
                                                               String operator,
                                                               Value value,
                                                               int type,
                                                               int transform)
                                                        throws RepositoryException
Throws:
RepositoryException

getTerm

protected org.apache.lucene.index.Term getTerm(String field,
                                               String value)

getValueString

protected String getValueString(Value value,
                                int type)
                         throws RepositoryException
Throws:
RepositoryException


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