SolrFacetDateQuery not working as expected

82 views
Skip to first unread message

James Welch

unread,
Sep 22, 2017, 10:38:40 AM9/22/17
to SolrNet
Hi all,

I'm trying to do a Date Facet, but running into a problem. The following code:


new SolrFacetDateQuery("proposal_submission_date", new DateTime(2004, 1, 1), new DateTime(DateTime.Now.Year, 1, 1), "+1YEARS")
        {
            HardEnd = true,
            Other = new[] { FacetDateOther.After, FacetDateOther.Before }
        });


I wasn't getting any FacetDate items in the response, so I inspected the URL via Fiddler and discovered that the URL generated for the request is shown below: 

http://<server>/solr/<core>/select?q=*&start=0&rows=10&fl=proposal_submission_date&facet=true
&facet.date=proposal_submission_date
&f.proposal_submission_date.facet.date.start=2004-01-01T00%3a00%3a00Z
&f.proposal_submission_date.facet.date.end=2017-01-01T00%3a00%3a00Z
&f.proposal_submission_date.facet.date.gap=%2b1YEARS
&f.proposal_submission_date.facet.date.hardend=true
&f.proposal_submission_date.facet.date.other=after
&f.proposal_submission_date.facet.date.other=before
&facet.limit=-1&debugQuery=true&version=2.2

However, it returns no date facets and the facet range XML in the raw response are blank as well.

When I modify the URL from "facet.date" to "facet.range" then everything works as expected.

http://<server>/solr/<core>/select?q=*&start=0&rows=10&fl=proposal_submission_date&facet=true
&facet.range=proposal_submission_date
&f.proposal_submission_date.facet.range.start=2004-01-01T00%3a00%3a00Z
&f.proposal_submission_date.facet.range.end=2017-01-01T00%3a00%3a00Z
&f.proposal_submission_date.facet.range.gap=%2b1YEARS
&f.proposal_submission_date.facet.range.hardend=true
&f.proposal_submission_date.facet.range.other=after
&f.proposal_submission_date.facet.range.other=before
&facet.limit=-1&debugQuery=true&version=2.2

The raw XML returned from this URL includes all of the date ranges as specified and works as I expected the SolrFacetDateQuery to work.

I'm following the SolrNet example for SolrFacetDateQuery from https://github.com/SolrNet/SolrNet/blob/master/Documentation/Facets.md

Also, the Solr 6.6 documentation doesn't show "facet.date" URL parameters, which is why I tried (and discovered) facet.range works.


Should I be doing something differently? 

Using SolrNet 0.7.1
Solr 6.6

thanks,
Jim

James Welch

unread,
Sep 22, 2017, 10:44:06 AM9/22/17
to SolrNet
https://lucene.apache.org/solr/guide/6_6/major-changes-from-solr-5-to-solr-6.html

facet.date.* Parameters Removed
The facet.date parameter (and associated facet.date.* parameters) that were deprecated in Solr 3.x have been removed completely. If you have not yet switched to using the equivalent facet.range functionality you must do so now before upgrading.


Just found this. Any chance the SolrFacetDateQuery can be updated in the next release?

thanks,
Jim
Reply all
Reply to author
Forward
0 new messages