public class LuceneQueryFactory extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
LuceneQueryFactory.QueryPair |
protected static class |
LuceneQueryFactory.Transform |
Modifier and Type | Field and Description |
---|---|
protected OperandEvaluator |
evaluator
Operand evaluator
|
protected SearchIndex |
index
Lucene search index
|
protected String |
mixinTypesField |
protected NamePathResolver |
npResolver
NamePathResolver to map namespace mappings to internal prefixes
|
protected NamespaceMappings |
nsMappings
Namespace mappings to internal prefixes
|
protected javax.jcr.nodetype.NodeTypeManager |
ntManager
Node type manager
|
protected String |
primaryTypeField |
protected SessionImpl |
session
Session of the user executing this query
|
Constructor and Description |
---|
LuceneQueryFactory(SessionImpl session,
SearchIndex index,
Map<String,javax.jcr.Value> bindVariables)
Creates a new lucene query factory.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addBooleanConstraint(org.apache.lucene.search.BooleanQuery query,
javax.jcr.query.qom.Constraint constraint,
org.apache.lucene.search.BooleanClause.Occur occur,
Map<String,javax.jcr.nodetype.NodeType> selectorMap,
JackrabbitIndexSearcher searcher) |
protected org.apache.lucene.search.Query |
create(javax.jcr.query.qom.Constraint constraint,
Map<String,javax.jcr.nodetype.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(javax.jcr.query.qom.Selector selector)
Creates a lucene query for the given QOM selector.
|
protected org.apache.lucene.index.Term |
createNodeTypeTerm(javax.jcr.nodetype.NodeType type) |
List<javax.jcr.query.Row> |
execute(Map<String,javax.jcr.query.qom.PropertyValue> columns,
javax.jcr.query.qom.Selector selector,
javax.jcr.query.qom.Constraint constraint,
org.apache.lucene.search.Sort sort,
boolean externalSort,
long offsetIn,
long limitIn) |
protected org.apache.lucene.search.BooleanQuery |
getAndQuery(javax.jcr.query.qom.And and,
Map<String,javax.jcr.nodetype.NodeType> selectorMap,
JackrabbitIndexSearcher searcher) |
protected org.apache.lucene.search.Query |
getComparisonQuery(javax.jcr.query.qom.DynamicOperand left,
int transform,
String operator,
javax.jcr.query.qom.StaticOperand rigth,
Map<String,javax.jcr.nodetype.NodeType> selectorMap) |
protected org.apache.lucene.search.Query |
getDescendantNodeQuery(javax.jcr.query.qom.DescendantNode dn,
JackrabbitIndexSearcher searcher) |
protected org.apache.lucene.search.Query |
getFullTextSearchQuery(javax.jcr.query.qom.FullTextSearch fts) |
protected org.apache.lucene.search.Query |
getNodeIdQuery(String field,
String path) |
protected org.apache.lucene.search.Query |
getNodeLocalNameQuery(int transform,
String operator,
javax.jcr.query.qom.StaticOperand right) |
protected org.apache.lucene.search.Query |
getNodeNameQuery(int transform,
String operator,
javax.jcr.query.qom.StaticOperand right) |
protected org.apache.jackrabbit.core.query.lucene.NotQuery |
getNotQuery(javax.jcr.query.qom.Not not,
Map<String,javax.jcr.nodetype.NodeType> selectorMap,
JackrabbitIndexSearcher searcher) |
protected org.apache.lucene.search.BooleanQuery |
getOrQuery(javax.jcr.query.qom.Or or,
Map<String,javax.jcr.nodetype.NodeType> selectorMap,
JackrabbitIndexSearcher searcher) |
protected org.apache.lucene.search.Query |
getPropertyExistenceQuery(javax.jcr.query.qom.PropertyExistence property) |
protected org.apache.lucene.search.Query |
getPropertyValueQuery(String field,
String operator,
javax.jcr.Value value,
int type,
int transform) |
protected org.apache.lucene.index.Term |
getTerm(String field,
String value) |
protected String |
getValueString(javax.jcr.Value value,
int type) |
protected Predicate |
mapConstraintToQueryAndFilter(LuceneQueryFactory.QueryPair query,
javax.jcr.query.qom.Constraint constraint,
Map<String,javax.jcr.nodetype.NodeType> selectorMap,
JackrabbitIndexSearcher searcher,
org.apache.lucene.index.IndexReader reader) |
protected final SessionImpl session
protected final javax.jcr.nodetype.NodeTypeManager ntManager
protected final SearchIndex index
protected final NamespaceMappings nsMappings
protected final NamePathResolver npResolver
protected final OperandEvaluator evaluator
protected final String mixinTypesField
protected final String primaryTypeField
public LuceneQueryFactory(SessionImpl session, SearchIndex index, Map<String,javax.jcr.Value> bindVariables) throws javax.jcr.RepositoryException
session
- the session that executes the query.index
- the search indexbindVariables
- the bind variable values of the queryjavax.jcr.RepositoryException
public List<javax.jcr.query.Row> execute(Map<String,javax.jcr.query.qom.PropertyValue> columns, javax.jcr.query.qom.Selector selector, javax.jcr.query.qom.Constraint constraint, org.apache.lucene.search.Sort sort, boolean externalSort, long offsetIn, long limitIn) throws javax.jcr.RepositoryException, IOException
columns
- selector
- constraint
- externalSort
- if true
it means that the lqf should just let the
QueryEngine take care of sorting and applying applying offset
and limit constraintsoffsetIn
- used in paginationlimitIn
- used in paginationjavax.jcr.RepositoryException
IOException
public org.apache.lucene.search.Query create(javax.jcr.query.qom.Selector selector) throws javax.jcr.RepositoryException
selector
- the selector.javax.jcr.RepositoryException
- if an error occurs while creating the query.protected org.apache.lucene.index.Term createNodeTypeTerm(javax.jcr.nodetype.NodeType type) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public org.apache.lucene.search.Query create(FullTextSearchImpl fts) throws javax.jcr.RepositoryException
fts
- the full text search constraint.javax.jcr.RepositoryException
- if an error occurs while creating the query.public org.apache.lucene.search.Query create(PropertyExistenceImpl prop) throws javax.jcr.RepositoryException
prop
- the QOM constraint.javax.jcr.RepositoryException
- if an error occurs while creating the query.protected Predicate mapConstraintToQueryAndFilter(LuceneQueryFactory.QueryPair query, javax.jcr.query.qom.Constraint constraint, Map<String,javax.jcr.nodetype.NodeType> selectorMap, JackrabbitIndexSearcher searcher, org.apache.lucene.index.IndexReader reader) throws javax.jcr.RepositoryException, IOException
javax.jcr.RepositoryException
IOException
protected org.apache.lucene.search.Query create(javax.jcr.query.qom.Constraint constraint, Map<String,javax.jcr.nodetype.NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws javax.jcr.RepositoryException, IOException
javax.jcr.RepositoryException
IOException
protected org.apache.lucene.search.Query getDescendantNodeQuery(javax.jcr.query.qom.DescendantNode dn, JackrabbitIndexSearcher searcher) throws javax.jcr.RepositoryException, IOException
javax.jcr.RepositoryException
IOException
protected org.apache.lucene.search.Query getFullTextSearchQuery(javax.jcr.query.qom.FullTextSearch fts) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected org.apache.lucene.search.BooleanQuery getAndQuery(javax.jcr.query.qom.And and, Map<String,javax.jcr.nodetype.NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws javax.jcr.RepositoryException, IOException
javax.jcr.RepositoryException
IOException
protected org.apache.lucene.search.BooleanQuery getOrQuery(javax.jcr.query.qom.Or or, Map<String,javax.jcr.nodetype.NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws javax.jcr.RepositoryException, IOException
javax.jcr.RepositoryException
IOException
protected void addBooleanConstraint(org.apache.lucene.search.BooleanQuery query, javax.jcr.query.qom.Constraint constraint, org.apache.lucene.search.BooleanClause.Occur occur, Map<String,javax.jcr.nodetype.NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws javax.jcr.RepositoryException, IOException
javax.jcr.RepositoryException
IOException
protected org.apache.jackrabbit.core.query.lucene.NotQuery getNotQuery(javax.jcr.query.qom.Not not, Map<String,javax.jcr.nodetype.NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws javax.jcr.RepositoryException, IOException
javax.jcr.RepositoryException
IOException
protected org.apache.lucene.search.Query getPropertyExistenceQuery(javax.jcr.query.qom.PropertyExistence property) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected org.apache.lucene.search.Query getComparisonQuery(javax.jcr.query.qom.DynamicOperand left, int transform, String operator, javax.jcr.query.qom.StaticOperand rigth, Map<String,javax.jcr.nodetype.NodeType> selectorMap) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected org.apache.lucene.search.Query getNodeNameQuery(int transform, String operator, javax.jcr.query.qom.StaticOperand right) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected org.apache.lucene.search.Query getNodeLocalNameQuery(int transform, String operator, javax.jcr.query.qom.StaticOperand right) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected org.apache.lucene.search.Query getNodeIdQuery(String field, String path) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected org.apache.lucene.search.Query getPropertyValueQuery(String field, String operator, javax.jcr.Value value, int type, int transform) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected String getValueString(javax.jcr.Value value, int type) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.