Can't run lucene queries with text ranges: title:[a TO d]
In lucene we can do either this title:[Aida TO Carmen] Or this title:{Aida TO Carmen}
In dotCMS neither of these work. I have a query like this: +structureName:webPageContent +webPageContent.title:[a TO d]
and I get this exception on the logs Caused by: org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [query], total failure; shardFailures {[x7pw-63dQYemdsHA9BRzQ][working20130207015342][1]: SearchParseException[[working20130207015342][1]: from[-1],size[20]: Parse Failure [Failed to parse source [{"size":20,"query":{"querystring":{"query":"+structurename:webpagecontent +webpagecontent.title:[a to d]"}}}]]]; nested: QueryParsingException[[working20130207015342] Failed to parse query [+structurename:webpagecontent +webpagecontent.title:[a to d]]]; nested: ParseException[Cannot parse '+structurename:webpagecontent +webpagecontent.title:[a to d]': Encountered " <RANGEINGOOP> "d "" at line 1, column 58. Was expecting: "]" ...
If you see the error, the query is translated to: +webpagecontent.title:[a to d]
but lucene needs the TO to be uppercase.
We handle this for dates, uppercasing the to to TO. But we only do it for dates, in the method ESContentFactoryImpl::findAndReplaceQueryDates
we need to also have a method to handle ranges where we're not using dates, but text.
Yes we haven't supported this syntax ever since we went to case insensitive searching. We'll get it in a patch to 2.5
While we are at this - are there other reserved lucene words that need to work and be uppercased other than TO ?
Will
Will Ezell http://dotcms.com phone: (305) 900-2001 ext. 7010 direct: (978) 294-9429 https://www.google.com/voice/b/0?pli=1#phones skype: wezell1
On Tue, Feb 26, 2013 at 7:29 AM, Jason Tesser [email protected]:
Yes we haven't supported this syntax ever since we went to case insensitive searching. We'll get it in a patch to 2.5
— Reply to this email directly or view it on GitHubhttps://github.com/dotCMS/dotCMS/issues/2193#issuecomment-14109796 .
the only one I know is the range operator that is case sensitive.
Thanks, Jason S. Tesser Director, Support Services dotCMS, Inc. T: 305.858.1422 x7003 http://twitter.com/dotCMS www.dotcms.com
On Tue, Feb 26, 2013 at 7:46 AM, dotCMS Code Review < [email protected]> wrote:
While we are at this - are there other reserved lucene words that need to work and be uppercased other than TO ?
Will
Will Ezell http://dotcms.com phone: (305) 900-2001 ext. 7010 direct: (978) 294-9429 https://www.google.com/voice/b/0?pli=1#phones skype: wezell1
On Tue, Feb 26, 2013 at 7:29 AM, Jason Tesser [email protected]:
Yes we haven't supported this syntax ever since we went to case insensitive searching. We'll get it in a patch to 2.5
— Reply to this email directly or view it on GitHub< https://github.com/dotCMS/dotCMS/issues/2193#issuecomment-14109796> .
— Reply to this email directly or view it on GitHubhttps://github.com/dotCMS/dotCMS/issues/2193#issuecomment-14110638 .
These are the ones I found on their documentation, inclusive and exclusive ranges
title:[Aida TO Carmen] title:{Aida TO Carmen}
@ravit See my comment on the pull request and change right away please. email/comment back when done. You don't have to make a new pull request just commit/push to the SAME branch
Jason pushed the code to same branch.
JT,
The regex we're using are too strict, matches = RegEX.find(query, "[([0-9]) (to) ([0-9])]"); if(matches.isEmpty()){
-
matches = RegEX.find(query, "\[([a-z]_) (to) ([a-z]_)\]"); -
matches = RegEX.find(query, "\[([a-z0-9]_) (to) ([a-z0-9]_)\]"); }
if we have [65656 TO 6565464] it works
but if you add an extra space it doesnt. so this [65656 TO 6565464]
wouldn't work.
@mabouza please don't reopen. We can open a new task. But I am not seeing the difference and having only one space is lucene syntax.
opened new issue here https://github.com/dotCMS/dotCMS/issues/2387
Sorry I didn't know we couldn't reopen I'll open a new one. Is lucene strict with the spaces as well? If so then I think it's fine, as long as it's not us forcing that :)