Christian Kolodziej wrote:
> 
> Hi Chris,
> 
>>I'm having a lot of trouble getting this query syntax to work correctly.
>>How
>>can I search for a date, which is either in the future OR missing
>>completely
>>(meaning open ended)
>>
>>I've tried -endDate:[* TO *] OR endDate[NOW TO *] but that doesn't work.
>>Adding parentheses doesn't help either.
> 
> Why do you use a range query for the endDate, that is not set? It's not
> tested yet but try -endDate:19700101T00:00:00Z (if it's a date field) or
> -date:0 (if you have saved timestamp). Another solution I would try is to
> use specific dates instead of NOW or * for the future.
> 
> Can you post the results of your trials, this might be interesting for
> other users, too.
> 
> Best regards,
> Christian
> 
> 
> 


Sorry, I think I over simplified my example, let me clarify my reasoning.
I'm searching for products that have a start date in the past up to the
present and have a end date in the present/future or none at all. I had
looked into searching for null dates and had come across the -date[* : *]
syntax, which searches for the absence of the index value for the field
specified.

Example: ( I thought this one would work)
product:foo AND startDate:[* TO NOW] AND (endDate:[NOW TO *] OR -endDate[* :
*])

I've gotten the syntax below to work but it seems overkill and redundant

((product:foo AND startDate:[* TO NOW] AND endDate:[NOW TO *]) OR
(product:foo AND startDate:[* TO NOW] AND (-endDate:[* TO *])))

Again I'm simplifying the actual query syntax for this example, but it seems
having to restate the product and startDate again in the query is overkill.
I thought their might be an easier way.

Thanks for your example. I'll try it out and post back.


-- 
View this message in context: 
http://www.nabble.com/Searching-for-future-or-%22null%22-dates-tp19502167p19515122.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to