lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antelmo Aguilar <aagui...@nd.edu>
Subject Re: Date Query Using Local Params
Date Mon, 10 Sep 2018 20:30:54 GMT
Hi Erik,

Thank you! I did mess with the v parameter, but I was doing it wrong.  I
was doing this v='([2013-07-08 TO 2013-07-09] OR [2013-07-21 TO
2013-07-25])'

Anyways, I needed to use the "fq" parameter and I did this fq=({!field
f=collection_date_range op=Within v='[2013-07-08 TO 2013-07-09]'} OR
{!field f=collection_date_range op=Within v='[2017-01-10 TO 2018-06-17]'})
and it worked like I would expect.

Thank you for all your help!

Best,
Antelmo

On Mon, Sep 10, 2018 at 4:18 PM, Erik Hatcher <erik.hatcher@gmail.com>
wrote:

> 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 <aaguilar@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 <apache@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
> >>
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message