On 11/17/2015 7:07 AM, Mugeesh Husain wrote: > when i fire query fq=date:[NOW/DAY-7DAYS TO NOW/DAY+1DAY], it is giving > below error > > "fq":"initial_release_date:[NOW/DAY-7DAYS TO NOW/DAY 1DAY]", > "rows":"32"}}, > "error":{ > "msg":"org.apache.solr.search.SyntaxError: Cannot parse > 'initial_release_date:[NOW/DAY-7DAYS TO NOW/DAY 1DAY]': Encountered \" > <RANGE_GOOP> \"1DAY \"\" at line 1, column 47.\nWas expecting one of:\n > \"]\" ...\n \"}\" ...\n ", > "code":400}}
How are you sending the queries to Solr? I'm betting that you are constructing a URL manually in your own code and sending it to Solr directly via HTTP, rather than using a Solr library like SolrJ, Solarium, Sunspot, etc. https://wiki.apache.org/solr/IntegratingSolr What's happening here is that the query is not URL escaped, which means the URL contains an actual plus sign for the "NOW/DAY+1DAY" part of your query. A plus sign in a URL is interpreted by the webserver as a space, in accordance with the standards that govern HTTP. This is not a bug. A Solr library would have taken care of all the URL escaping for characters that require it, and the user code is typically a lot easier to write than URL construction code. Whatever programming language you are using to construct your queries very likely has a function for doing URL escaping on the parameters for your URL. You would want to be careful to only run it on the values in your parameters, not the entire URL, or it would escape everything and the URL would not work. The URL escaped version of a plus sign is %2B if you want to quickly fix this before you look into URL escaping functions or a Solr library. Thanks, Shawn