I'm having troubles searching for documents which date fall within the range I specify in my query.
The schema configuration is the following
<field name="dates" type="rdates" stored="true" />
<fieldType name="rdates" class="solr.DateRangeField" multiValued="true" />
These are the documents I have indexed in Solr
Query: q=dates:*
{
"responseHeader":{
"params":{
"q":"dates:*",
"_":"1518809837624"}},
"response":{"numFound":2,"start":0,"docs":[
{
"id":1,
"dates":["[2015-12-31 TO 2016-01-01]"],
"_version_":1592586045307748352},
{
"id":2,
"dates":["[2015 TO 2017]",
"[2013 TO 2015]"],
"_version_":1592595675256717312}]
}}
And these are the documents that match the user's query:
Query: fq={!field f=dates op=Within}[2012 TO 2016]&q=dates:*
{
"responseHeader":{
"params":{
"q":"*:*",
"fq":"{!field f=dates op=Within}[2012 TO 2016]",
"_":"1518808413748"}},
"response":{"numFound":1,"start":0,"docs":[
{
"id":1,
"dates":["[2015-12-31 TO 2016-01-01]"],
"_version_":1592586045307748352}]
}}
As I understand, the document with the ID 2 should match given that one of the values in the dates field match with my query.
Indeed, changing the document ID=2 to have only the value [2013 TO 2015]
in the dates field, it matches my query.
Query: fq={!field f=dates op=Within}[2012 TO 2016]&q=dates:*
{
"responseHeader":{
"params":{
"q":"dates:*",
"fq":"{!field f=dates op=Within}[2012 TO 2016]",
"_":"1518808413748"}},
"response":{"numFound":2,"start":0,"docs":[
{
"id":1,
"dates":["[2015-12-31 TO 2016-01-01]"],
"_version_":1592586045307748352},
{
"id":2,
"dates":["[2013 TO 2015]"],
"_version_":1592597631061721088}]
}}
How should I query for documents that fall within the range specified by the query?
Same code and configuration, different days, it worked
I think my computer doesn't like to work Friday afternoons.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.