[ 
https://issues.apache.org/jira/browse/METAMODEL-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14513173#comment-14513173
 ] 

Kasper Sørensen commented on METAMODEL-135:
-------------------------------------------

This is actually not a bug, but rather a case where the filter items where 
properly parsed. The expression-based filter items will only occur when parsing 
fails. It's as such a "last resort" for cases where you need (typically in SQL) 
to allow a user-written filter condition that is not supported by the query 
model of MM.

What I do realize is that this is under-documented. We should do something 
about it, as well as expression-based SelectItem (which generally work the same 
way). The only clear indication of this is currently in the constructor of 
FilterItem - 
http://metamodel.apache.org/apidocs/3.4.1/org/apache/metamodel/query/FilterItem.html#FilterItem(java.lang.String)
 - but we should improve also the javadoc of getExpression().

> SQL parsing fails when 'AND' or 'OR' keywords are in caps
> ---------------------------------------------------------
>
>                 Key: METAMODEL-135
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-135
>             Project: Apache MetaModel
>          Issue Type: Task
>            Reporter: Ashish Mukherjee
>
> This is what my client code is:
>   DataContext dataContext = new SolrDataContext(url, index);
>   DataSet dataSet = dataContext
>                 .executeQuery("SELECT price FROM collection1 WHERE (((manu = 
> 'Samsung') AND name = 'hard'))");
> In my SolrDataContext class:
> FilterClause clause = q.getWhereClause();
>         if (clause != null) {
>             List<FilterItem> filterItemList = clause.getItems();
>             boolean isFirst = true;
>             
>             for (FilterItem filterItem : filterItemList) {
>                 String expr = filterItem.getExpression();
>                 System.out.println(expr);
> ....
> expr is null when 'AND' is in caps but gives the correct expression when it 
> is written as 'and' in the query. Same is true for 'OR' and 'or'. Looks like 
> the parsing is case-sensitive somewhere.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to