Say I have a field defined in my schema and then indexed as 'dmvf_rab_date_range'
<fieldType name="date_range" class="solr.DateRangeField" multiValued="true" indexed="true"/>
<dynamicField name="dmvf_*" type="date_range" indexed="true" stored="true" multiValued="true" />
And then index a set of values such that they are returned like the following:
["[2018-04-07 TO 2018-04-07]",
"[2018-04-14 TO 2018-04-27]",
"[2018-05-05 TO 2018-05-05]",
"[2018-11-03 TO 2018-11-16]",
"[2018-11-24 TO 2019-01-04]"],
I'm trying to query such that I'll match a single value of the multivalued field or will fall completely in between a single value. But currently, my query just seems to see if it'll partially match in any of the values and return the document if that's the case.
Like if I query:
&fq=dmvf_rab_date_range:[2018-11-10 TO 2018-11-24]
That document will be returned even though it doesn't match or fall completely between a single value of the field.
The default operator for DateRangeFields is Intersects
. Since your query range intersects / overlaps with [2018-11-03 TO 2018-11-16]
, you get a hit.
You can set the operator through a localparam:
&fq={!field f=dmvf_rab_date_range op=Contains}[2018-11-10 TO 2018-11-24]
This will give you a match if the indexed range contains the query range. You also have the operator Within
- giving you ranges that fall within the query range (I wasn't completely sure which you wanted).