Package org.nuxeo.elasticsearch.query
Class NxqlQueryConverter
- java.lang.Object
-
- org.nuxeo.elasticsearch.query.NxqlQueryConverter
-
public final class NxqlQueryConverter extends Object
Helper class that holds the conversion logic. Conversion is based on the existing NXQL Parser, we are just using a visitor to build the ES request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NxqlQueryConverter.ExpressionBuilder
static class
NxqlQueryConverter.QueryAndFilter
Class to hold both a query and a filter
-
Field Summary
Fields Modifier and Type Field Description protected static int
MORE_LIKE_THIS_MAX_QUERY_TERMS
Deprecated.since 11.1.protected static int
MORE_LIKE_THIS_MIN_DOC_FREQ
Deprecated.since 11.1.protected static int
MORE_LIKE_THIS_MIN_TERM_FREQ
Deprecated.since 11.1.protected static String
SELECT_ALL
protected static String
SELECT_ALL_WHERE
protected static String
SIMPLE_QUERY_PREFIX
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static SQLQuery
addSecurityPolicy(CoreSession session, SQLQuery query)
protected static Object
checkBoolValue(String nxqlName, Object value)
protected static String
completeQueryWithSelect(String nxql)
protected static String
getFieldName(String name, EsHint hint)
protected static org.elasticsearch.index.query.MoreLikeThisQueryBuilder.Item[]
getItems(Object value)
Deprecated.since 11.1.static Map<String,Type>
getSelectClauseFields(String nxql)
static List<SortInfo>
getSortInfo(String nxql)
protected static SQLQuery
getSqlQuery(String nxql)
protected static String
likeToWildcard(String like)
Turns a NXQL LIKE pattern into a wildcard for WildcardQuery.protected static org.elasticsearch.index.query.QueryBuilder
makeAncestorIdFilter(String value, CoreSession session)
protected static org.elasticsearch.index.query.QueryBuilder
makeFulltextQuery(String nxqlName, String value, EsHint hint)
protected static org.elasticsearch.index.query.QueryBuilder
makeHintQuery(String name, Object value, EsHint hint)
protected static org.elasticsearch.index.query.QueryBuilder
makeLikeQuery(String op, String name, String value, EsHint hint)
static NxqlQueryConverter.QueryAndFilter
makeQueryFromSimpleExpression(String op, String nxqlName, Object value, Object[] values, EsHint hint, CoreSession session)
static org.elasticsearch.index.query.QueryBuilder
makeStartsWithQuery(String name, Object value)
protected static org.elasticsearch.index.query.QueryBuilder
makeTrashedFilter(String op, String name, String value)
static org.elasticsearch.index.query.QueryBuilder
toESQueryBuilder(String nxql)
static org.elasticsearch.index.query.QueryBuilder
toESQueryBuilder(String nxql, CoreSession session)
static String
translateFulltextQuery(String query)
Translates from Nuxeo syntax to Elasticsearch simple_query_string syntax.
-
-
-
Field Detail
-
SELECT_ALL
protected static final String SELECT_ALL
- See Also:
- Constant Field Values
-
SELECT_ALL_WHERE
protected static final String SELECT_ALL_WHERE
- See Also:
- Constant Field Values
-
SIMPLE_QUERY_PREFIX
protected static final String SIMPLE_QUERY_PREFIX
- See Also:
- Constant Field Values
-
MORE_LIKE_THIS_MIN_TERM_FREQ
@Deprecated protected static final int MORE_LIKE_THIS_MIN_TERM_FREQ
Deprecated.since 11.1. UseMoreLikeThisESHintQueryBuilder.MORE_LIKE_THIS_MIN_TERM_FREQ
instead.- See Also:
- Constant Field Values
-
MORE_LIKE_THIS_MIN_DOC_FREQ
@Deprecated protected static final int MORE_LIKE_THIS_MIN_DOC_FREQ
Deprecated.since 11.1. UseMoreLikeThisESHintQueryBuilder.MORE_LIKE_THIS_MIN_DOC_FREQ
instead.- See Also:
- Constant Field Values
-
MORE_LIKE_THIS_MAX_QUERY_TERMS
@Deprecated protected static final int MORE_LIKE_THIS_MAX_QUERY_TERMS
Deprecated.since 11.1. UseMoreLikeThisESHintQueryBuilder.MORE_LIKE_THIS_MAX_QUERY_TERMS
instead.- See Also:
- Constant Field Values
-
-
Method Detail
-
toESQueryBuilder
public static org.elasticsearch.index.query.QueryBuilder toESQueryBuilder(String nxql)
-
toESQueryBuilder
public static org.elasticsearch.index.query.QueryBuilder toESQueryBuilder(String nxql, CoreSession session)
-
getSqlQuery
protected static SQLQuery getSqlQuery(String nxql)
-
addSecurityPolicy
protected static SQLQuery addSecurityPolicy(CoreSession session, SQLQuery query)
-
completeQueryWithSelect
protected static String completeQueryWithSelect(String nxql)
-
makeQueryFromSimpleExpression
public static NxqlQueryConverter.QueryAndFilter makeQueryFromSimpleExpression(String op, String nxqlName, Object value, Object[] values, EsHint hint, CoreSession session)
-
checkBoolValue
protected static Object checkBoolValue(String nxqlName, Object value)
-
makeTrashedFilter
protected static org.elasticsearch.index.query.QueryBuilder makeTrashedFilter(String op, String name, String value)
-
makeHintQuery
protected static org.elasticsearch.index.query.QueryBuilder makeHintQuery(String name, Object value, EsHint hint)
-
getItems
@Deprecated protected static org.elasticsearch.index.query.MoreLikeThisQueryBuilder.Item[] getItems(Object value)
Deprecated.since 11.1. UseMoreLikeThisESHintQueryBuilder.getItems(Object)
instead.
-
makeStartsWithQuery
public static org.elasticsearch.index.query.QueryBuilder makeStartsWithQuery(String name, Object value)
-
makeAncestorIdFilter
protected static org.elasticsearch.index.query.QueryBuilder makeAncestorIdFilter(String value, CoreSession session)
-
makeLikeQuery
protected static org.elasticsearch.index.query.QueryBuilder makeLikeQuery(String op, String name, String value, EsHint hint)
-
likeToWildcard
protected static String likeToWildcard(String like)
Turns a NXQL LIKE pattern into a wildcard for WildcardQuery.% and _ are standard wildcards, and \ escapes them.
- Since:
- 7.4
-
makeFulltextQuery
protected static org.elasticsearch.index.query.QueryBuilder makeFulltextQuery(String nxqlName, String value, EsHint hint)
-
getFieldName
protected static String getFieldName(String name, EsHint hint)
-
getSortInfo
public static List<SortInfo> getSortInfo(String nxql)
-
getSelectClauseFields
public static Map<String,Type> getSelectClauseFields(String nxql)
-
translateFulltextQuery
public static String translateFulltextQuery(String query)
Translates from Nuxeo syntax to Elasticsearch simple_query_string syntax.
-
-