Hi all,

On Solr 8.6, I have a multivalued field of dateRange type which contains an
availability table.

<field name="availabilities" docValues="false" type="dateRange"
multiValued="true" indexed="true" required="false" stored="true"/>
"availabilities": [
  "[2021-12-22T00:00:00Z TO 2022-01-02T23:59:59Z]",
  "[2022-01-20T00:00:00Z TO 2022-02-02T23:59:59Z]",
  "[2022-02-10T00:00:00Z TO 2022-02-21T23:59:59Z]"
]

With a facet, I want to be able to select the available and/or unavailable
people. The Solr query is as follows and works well.

http://localhost:8985/solr/rby/select?facet=on&facet.query={!key="FQ4@Availa
ble now" ex=tag_availabilities}availabilities:[NOW TO
NOW]&fl=id,availabilities&fq={!tag=tag_availabilities}availabilities:([NOW
TO NOW])&q=*:*&rows=10&wt=json

For the unavailable people query, it does not work when I exclude NOW with
{} like this.

http://localhost:8985/solr/rby/select?facet=on&facet.query={!key="FQ4@Unavai
lable" ex=tag_availabilities}availabilities:{NOW TO
NOW}&fl=id,availabilities&fq={!tag=tag_availabilities}availabilities:({NOW
TO NOW})&q=*:*&rows=10&wt=json

Solr answers with the following error:

"msg": "Wrong order: 2021-12-30T16:18:06.304 TO 2021-12-30T16:18:06.302",

I found a workaround with - before field but now I can't combine the two
filters of the facet with an OR.

http://localhost:8985/solr/rby/select?facet=on&facet.query={!key="FQ4@Unavai
lable" ex=tag_availabilities}-availabilities:[NOW TO
NOW]&fl=id,availabilities&fq={!tag=tag_availabilities}-availabilities:([NOW
TO NOW])&q=*:*&rows=1000&wt=json

Thanks for your help


Reply via email to