When using the {!...} syntax, and combining it with other clauses, the 
expression parsed needs to come from a local-param `v` parameter (otherwise, 
without `v`, the parser eats the rest of the string after the closing curly 
bracket).  So you could do something like this:


    q={!field f=collection_date_range op=Within v='[2013-07-08 TO 2013-07-09]'} 
OR {!field
f=collection_date_range op=Within v='[2013-07-21 TO 2013-07-25]'}

Or you could do this sort of thing, which allows the date ranges to be 
parameterized:

    q={!field f=collection_date_range op=Within v=$range1} OR {!field
f=collection_date_range op=Within v=$range2}
     &range1=[2013-07-08 TO 2013-07-09]
     &range2=[2013-07-21 TO 2013-07-25]

        Erik





> On Sep 10, 2018, at 3:59 PM, Antelmo Aguilar <aagui...@nd.edu> wrote:
> 
> Hi Shawn,
> 
> Thank you.  So just to confirm, there is no way for me to use an OR
> operator with also using the "within" op parameter described in the bottom
> of this page?
> 
> https://lucene.apache.org/solr/guide/6_6/working-with-dates.html#WorkingwithDates-MoreDateRangeFieldDetails
> 
> I appreciate your resposne.
> 
> Best,
> Antelmo
> 
> On Mon, Sep 10, 2018 at 3:51 PM, Shawn Heisey <apa...@elyograg.org> wrote:
> 
>> On 9/10/2018 1:21 PM, Antelmo Aguilar wrote:
>> 
>>> Hi,
>>> 
>>> I have a question.  I am trying to use the "within" op parameter in a Date
>>> Search.  This works like I would expect: {!field f=collection_date_range
>>> op=Within}[2013-07-08 TO 2013-07-09]
>>> 
>>> I would like to use an OR with the query though, something like this:
>>> {!field
>>> f=collection_date_range op=Within}[2013-07-08 TO 2013-07-09] OR {!field
>>> f=collection_date_range op=Within}[2013-07-21 TO 2013-07-25]
>>> 
>>> However, I tried different approaches and none of them worked.  Is there a
>>> way of doing something like this for querying dates using the "within" op
>>> parameter?
>>> 
>> 
>> I don't think the field parser can do this.  Also, usually it's not
>> possible to use localparams in a second query clause like that --
>> localparams must almost always be the very first thing in the "q"
>> parameter, or they will not be interpreted as localparams.  Use the
>> standard (lucene) parser without localparams.  The q parameter should look
>> like this:
>> 
>> collection_date_range:[2013-07-08 TO 2013-07-09] OR
>> collection_date_range:[2013-07-21 TO 2013-07-25]
>> 
>> If the default operator hasn't been changed (which would mean it is using
>> OR), then you could remove the "OR" from that.
>> 
>> Thanks,
>> Shawn
>> 
>> 

Reply via email to