Class NXQLQueryMaker.QueryAnalyzer
- java.lang.Object
-
- org.nuxeo.ecm.core.query.sql.model.DefaultQueryVisitor
-
- org.nuxeo.ecm.core.storage.sql.jdbc.NXQLQueryMaker.QueryAnalyzer
-
- All Implemented Interfaces:
IVisitor
- Enclosing class:
- NXQLQueryMaker
protected class NXQLQueryMaker.QueryAnalyzer extends DefaultQueryVisitor
Collects various info about the query AST, and rewrites the toplevel ANDPredicate
s of the WHERE clause into a singleMultiExpression
for easier analysis.
-
-
Field Summary
Fields Modifier and Type Field Description protected FacetFilter
facetFilter
protected int
ftCount
protected boolean
hasSelectCollection
Do we have a SELECT somelist/* FROM ...protected boolean
hasWildcardIndex
protected boolean
inOrderBy
protected boolean
inSelect
protected boolean
onlyRelations
Do we match only relations (and therefore no proxies).protected List<String>
orderByColumnNames
protected boolean
orderByHasWildcardIndex
protected boolean
orderByScore
protected boolean
selectScore
protected LinkedList<Predicate>
toplevelPredicates
protected List<String>
whatColumnNames
protected MultiExpression
wherePredicate
-
Constructor Summary
Constructors Constructor Description QueryAnalyzer(FacetFilter facetFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFacetFilterClauses(FacetFilter facetFilter)
protected void
analyzeToplevelIsProxy(Expression expr)
protected void
analyzeToplevelPredicates(Predicate predicate)
Process special toplevel ANDed operands: ecm:isProxyprotected void
analyzeToplevelProxyProperty(Expression expr)
protected void
checkProperty(String xpath)
Checks that a property exists.protected void
init()
protected void
simplifyToplevelPredicates()
Simplify ecm:primaryType positive references, and non-per-instance mixin types.void
visitExpression(Expression node)
protected void
visitExpressionFulltext(Expression node, String name)
void
visitFromClause(FromClause node)
Finds all the types to take into account (all concrete types being a subtype of the passed types) based on the FROM list.void
visitFunction(Function node)
void
visitOrderByClause(OrderByClause node)
void
visitQuery(SQLQuery node)
void
visitReference(Reference node)
void
visitSelectClause(SelectClause node)
void
visitWhereClause(WhereClause node)
-
Methods inherited from class org.nuxeo.ecm.core.query.sql.model.DefaultQueryVisitor
visitBooleanLiteral, visitDateLiteral, visitDoubleLiteral, visitGroupByClause, visitHavingClause, visitIntegerLiteral, visitLiteral, visitLiteralList, visitMultiExpression, visitOperandList, visitOperator, visitOrderByExpr, visitOrderByList, visitReferenceList, visitStringLiteral
-
-
-
-
Field Detail
-
facetFilter
protected FacetFilter facetFilter
-
inSelect
protected boolean inSelect
-
inOrderBy
protected boolean inOrderBy
-
toplevelPredicates
protected LinkedList<Predicate> toplevelPredicates
-
wherePredicate
protected MultiExpression wherePredicate
-
onlyRelations
protected boolean onlyRelations
Do we match only relations (and therefore no proxies).
-
hasSelectCollection
protected boolean hasSelectCollection
Do we have a SELECT somelist/* FROM ...
-
hasWildcardIndex
protected boolean hasWildcardIndex
-
orderByHasWildcardIndex
protected boolean orderByHasWildcardIndex
-
ftCount
protected int ftCount
-
selectScore
protected boolean selectScore
-
orderByScore
protected boolean orderByScore
-
-
Constructor Detail
-
QueryAnalyzer
public QueryAnalyzer(FacetFilter facetFilter)
-
-
Method Detail
-
init
protected void init()
-
visitQuery
public void visitQuery(SQLQuery node)
- Specified by:
visitQuery
in interfaceIVisitor
- Overrides:
visitQuery
in classDefaultQueryVisitor
-
addFacetFilterClauses
public void addFacetFilterClauses(FacetFilter facetFilter)
-
visitSelectClause
public void visitSelectClause(SelectClause node)
- Specified by:
visitSelectClause
in interfaceIVisitor
- Overrides:
visitSelectClause
in classDefaultQueryVisitor
-
visitFromClause
public void visitFromClause(FromClause node)
Finds all the types to take into account (all concrete types being a subtype of the passed types) based on the FROM list.Adds them as a ecm:primaryType match in the toplevel operands.
- Specified by:
visitFromClause
in interfaceIVisitor
- Overrides:
visitFromClause
in classDefaultQueryVisitor
-
visitWhereClause
public void visitWhereClause(WhereClause node)
- Specified by:
visitWhereClause
in interfaceIVisitor
- Overrides:
visitWhereClause
in classDefaultQueryVisitor
-
analyzeToplevelPredicates
protected void analyzeToplevelPredicates(Predicate predicate)
Process special toplevel ANDed operands: ecm:isProxy
-
simplifyToplevelPredicates
protected void simplifyToplevelPredicates()
Simplify ecm:primaryType positive references, and non-per-instance mixin types.
-
analyzeToplevelIsProxy
protected void analyzeToplevelIsProxy(Expression expr)
-
analyzeToplevelProxyProperty
protected void analyzeToplevelProxyProperty(Expression expr)
-
visitExpression
public void visitExpression(Expression node)
- Specified by:
visitExpression
in interfaceIVisitor
- Overrides:
visitExpression
in classDefaultQueryVisitor
-
visitExpressionFulltext
protected void visitExpressionFulltext(Expression node, String name)
-
visitReference
public void visitReference(Reference node)
- Specified by:
visitReference
in interfaceIVisitor
- Overrides:
visitReference
in classDefaultQueryVisitor
-
checkProperty
protected void checkProperty(String xpath)
Checks that a property exists.- Throws:
QueryParseException
- if the property doesn't exist
-
visitFunction
public void visitFunction(Function node)
- Specified by:
visitFunction
in interfaceIVisitor
- Overrides:
visitFunction
in classDefaultQueryVisitor
-
visitOrderByClause
public void visitOrderByClause(OrderByClause node)
- Specified by:
visitOrderByClause
in interfaceIVisitor
- Overrides:
visitOrderByClause
in classDefaultQueryVisitor
-
-