tags:

views:

56

answers:

1

I have this piece of code here below:

$fq.=" + (fritidsboende_uth_from:[$fritids_uth_from TO *] 
AND fritidsboende_uth_to:[* TO $fritids_uth_to]) 
OR (fritidsboende_uth_from:'1972-01-01T01:01:00Z' 
AND fritidsboende_uth_to:'2019-01-01T01:01:00Z')";

I have noticed my app doesn't get anything behind the colon, in this part of the code:

  OR (fritidsboende_uth_from:'1972-01-01T01:01:00Z' // Notice the colon in the date string

I get this error msg: Unrecognized date string: '1972-01-01T01'. Nothing from behind the colon is there though.

How should I 'escape' it so that the colon is properly recognized?

Its PHP...

Thanks

UPDATE:

I have this querystring, so maybe the colon is lost in this translation...hmm...

+%28fritidsboende_uth_from%3A%5B2010-04-09T01%3A01%3A00Z+TO+%2A%5D+AND+fritidsboende_uth_to%3A%5B%2A+TO+2010-04-10T01%3A01%3A00Z%5D%29+OR+%28fritidsboende_uth_from%3A1972-01-01T01%3A01%3A00Z+AND+fritidsboende_uth_to%3A2019-01-01T01%3A
A: 

EDIT based on SOLR comment by OP

try adding braces and complete the ranges, like:

$fq.=" + (fritidsboende_uth_from:[$fritids_uth_from TO *] 
AND fritidsboende_uth_to:[* TO $fritids_uth_to]) 
OR (fritidsboende_uth_from:[1972-01-01T01:01:00Z TO *] 
AND fritidsboende_uth_to:[* TO 2019-01-01T01:01:00Z])";

see: http://stackoverflow.com/questions/796753/solr-fetching-date-ranges

KM
same prob... doesn't work
Camran
in that case the error is most likely coming from the database and not PHP, you need to have the date-time formatted so your database will accept it. you don't say which database you're using, but just try using the date with no time: `1972-01-01` and `2019-01-01`
KM
ok, I am using SOLR. Thing is I am using a http communications script to communicate with solr via http. If you have any knowledge about querystrings, check my update. Thanks
Camran