How to specify a date facet request in Solr?

When I make a request to Solr, I return these facet_counts:

'facet_counts' => {
    'facet_dates' => {
        'photo_added' => {
            '2009-12-28T18:00:00Z' => 396386,
            '2010-05-28T18:00:00Z' => 415370,
            'gap' => '+1MONTH',
            'end' => '2011-02-28T18:00:00Z',
        },
    },
},

However, when I add any of these parameters to the request q=*:*:

fq=photo_added:2009-12-28T18:00:00Z
fq=photo_added:2009-12-28T18%3A00%3A00Z

I get this as an answer:

HTTP ERROR 400: Invalid Date String:'2009-12-28T18'

When I add any of these parameters to the query q=*:*:

fq=photo_added:"2009-12-28T18:00:00Z"
fq=photo_added:"2009-12-28T18%3A00%3A00Z"
fq%3Dphoto_added%3A%222009-12-28T18%3A00%3A00Z%22
fq=photo_added%3A"2009-12-28T18%3A00%3A00Z"

I get this in response:

<result name="response" numFound="0" start="0"/>

But when I have no limit fq=for my request, I get it numFound="8001000", so it is definitely something wrong with the restriction fq=.

How can I execute a date facet request?

+3
source share
1 answer

, . IIRC, 1 , '2009-12-28T18:00:00Z' => 396386 , 2009-12-28T18: 00: 00Z 2010-01-28T18: 00: 00Z ( ) 396386 .

, , . 396386, , : fq=photo_added:[2009-12-28T18:00:00Z TO 2010-01-28T18:00:00Z]

+5

Source: https://habr.com/ru/post/1789114/


All Articles