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 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,Value> bindVariables)
Creates a new lucene query factory.
|
| Modifier and Type | Method and Description |
|---|---|
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,
org.apache.lucene.search.Sort sort,
boolean externalSort,
long offsetIn,
long limitIn) |
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) |
protected final SessionImpl session
protected final 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,Value> bindVariables) throws RepositoryException
session - the session that executes the query.index - the search indexbindVariables - the bind variable values of the queryRepositoryExceptionpublic List<Row> execute(Map<String,PropertyValue> columns, Selector selector, Constraint constraint, org.apache.lucene.search.Sort sort, boolean externalSort, long offsetIn, long limitIn) throws 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 paginationRepositoryExceptionIOExceptionpublic org.apache.lucene.search.Query create(Selector selector) throws RepositoryException
selector - the selector.RepositoryException - if an error occurs while creating the query.protected org.apache.lucene.index.Term createNodeTypeTerm(NodeType type) throws RepositoryException
RepositoryExceptionpublic org.apache.lucene.search.Query create(FullTextSearchImpl fts) throws RepositoryException
fts - the full text search constraint.RepositoryException - if an error occurs while creating the query.public org.apache.lucene.search.Query create(PropertyExistenceImpl prop) throws RepositoryException
prop - the QOM constraint.RepositoryException - if an error occurs while creating the query.protected Predicate mapConstraintToQueryAndFilter(LuceneQueryFactory.QueryPair query, Constraint constraint, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher, org.apache.lucene.index.IndexReader reader) throws RepositoryException, IOException
RepositoryExceptionIOExceptionprotected org.apache.lucene.search.Query create(Constraint constraint, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws RepositoryException, IOException
RepositoryExceptionIOExceptionprotected org.apache.lucene.search.Query getDescendantNodeQuery(DescendantNode dn, JackrabbitIndexSearcher searcher) throws RepositoryException, IOException
RepositoryExceptionIOExceptionprotected org.apache.lucene.search.Query getFullTextSearchQuery(FullTextSearch fts) throws RepositoryException
RepositoryExceptionprotected org.apache.lucene.search.BooleanQuery getAndQuery(And and, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws RepositoryException, IOException
RepositoryExceptionIOExceptionprotected org.apache.lucene.search.BooleanQuery getOrQuery(Or or, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws RepositoryException, IOException
RepositoryExceptionIOExceptionprotected 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
RepositoryExceptionIOExceptionprotected org.apache.jackrabbit.core.query.lucene.NotQuery getNotQuery(Not not, Map<String,NodeType> selectorMap, JackrabbitIndexSearcher searcher) throws RepositoryException, IOException
RepositoryExceptionIOExceptionprotected org.apache.lucene.search.Query getPropertyExistenceQuery(PropertyExistence property) throws RepositoryException
RepositoryExceptionprotected org.apache.lucene.search.Query getComparisonQuery(DynamicOperand left, int transform, String operator, StaticOperand rigth, Map<String,NodeType> selectorMap) throws RepositoryException
RepositoryExceptionprotected org.apache.lucene.search.Query getNodeNameQuery(int transform,
String operator,
StaticOperand right)
throws RepositoryException
RepositoryExceptionprotected org.apache.lucene.search.Query getNodeLocalNameQuery(int transform,
String operator,
StaticOperand right)
throws RepositoryException
RepositoryExceptionprotected org.apache.lucene.search.Query getNodeIdQuery(String field, String path) throws RepositoryException
RepositoryExceptionprotected org.apache.lucene.search.Query getPropertyValueQuery(String field, String operator, Value value, int type, int transform) throws RepositoryException
RepositoryExceptionprotected String getValueString(Value value, int type) throws RepositoryException
RepositoryExceptionCopyright © 2004–2022 The Apache Software Foundation. All rights reserved.