Thank you Diego! This works with some small changes. My feature ended up
looking like this:

{
  "name" : "FeatureA",
  "store" : "commonFeatureStore",
  "class" : "org.apache.solr.ltr.feature.SolrFeature",
  "params" : {
    "q" : "{!func}if(gt(ms(CutoffDate,NOW),0),exists(query({!v=
PreZones:${zone}})),exists(query({!v=PostZones:${zone}})))"
  }
},

On Tue, Aug 29, 2017 at 12:32 PM, Diego Ceccarelli <
diego.ceccare...@gmail.com> wrote:

> Hi Brian,
>
> The plugin doesn't allow you to express multiple function queries in the
> same feature. Maybe in this case you can express both the tw queries in one
> unique function query, using the if function.
>
> Something like:
>
> "fq":"if(gt(ms(NOW,mydatefield),0,query(PreCutOffZones:${zone}), query(
> PostCutOffZones:${zone}))"
>
>
> (Function query documentation here:
> https://cwiki.apache.org/confluence/display/solr/Function+Queries)
>
> Let me know if it works.
>
> Cheers,
> Diego
>
>
>
>
>
>
>
> On Tue, Aug 29, 2017 at 5:47 PM, Brian Yee <yee.bri...@gmail.com> wrote:
>
> > Hello,
> >
> > I have a somewhat complex solr filter query that I am hoping to turn
> into a
> > feature for learning to rank, but I am not sure if it's possible. I would
> > like to OR two fq together for one of my features. I have a cutoff date
> and
> > I need to check one field if NOW is before the cutoff, and a different
> > field if NOW is after the cutoff. Is this possible?
> >
> > Something to the effect of this:
> > {
> >   "name" : "FeatureA",
> >   "store" : "commonFeatureStore",
> >   "class" : "org.apache.solr.ltr.feature.SolrFeature",
> >   "params" : {
> >     "fq" : [
> >       "{!frange l=NOW}CutOffDate",
> >       "{!term f=PreCutOffZones}${zone}"
> >     ]
> >     OR
> >     "fq" : [
> >       "{!frange u=NOW}CutOffDate",
> >       "{!term f=PostCutOffZones}${zone}"
> >     ]
> >   }
> > },
> >
> > Thank you!
> > Brian Yee
> >
>

Reply via email to