Search API allows the facetapi to use a gap with a maximum granularity, but there is currently no way to specify a minimum granularity.

For instance if I have 10 news documents all within the previous hour, the 'Granularity' setting allows a user to say 'Don't try to drill down to the minute, but stick with days, even if there is only 1'.
The new "Minimum granularity" allows a user to say even if we have years of news documents, start with the month.

Comments

relaxnow created an issue. See original summary.

relaxnow’s picture

relaxnow’s picture

Status: Needs work » Needs review
relaxnow’s picture

Backported patch to 7.x-1.6

Status: Needs review » Needs work

The last submitted patch, 4: search_api-facetapi_min_granularity-2649412-4-7.x-1.6.patch, failed testing.

relaxnow’s picture

Added screenshots of form and a configured instance that only shows months (while it has years worth of data).

relaxnow’s picture

relaxnow’s picture

Status: Needs work » Needs review
drunken monkey’s picture

Status: Needs review » Needs work

Thanks a lot for posting this!

  1. +++ b/contrib/search_api_facetapi/plugins/facetapi/adapter.inc
    @@ -272,8 +272,19 @@ class SearchApiFacetapiAdapter extends FacetapiAdapter {
    -      // Date facets don't support the "OR" operator (for now).
    -      $form['global']['operator']['#access'] = FALSE;
    

    I don't think this was removed on purpose?

  2. +++ b/contrib/search_api_facetapi/plugins/facetapi/query_type_date.inc
    @@ -249,11 +259,15 @@ class SearchApiFacetapiDate extends SearchApiFacetapiTerm implements FacetapiQue
    +        // Gets gap numbers for both the gap, minimum and maximum gap,
    +        // checks if the gap is within the limit
    +        // set by the $granularity parameters.
    

    Comments should break to as close as possible to 80 characters line length.

Otherwise, this looks great, and also seems to work well. Thanks again!

goz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.57 KB
new1.7 KB

Thanks for the patch, it's very helpful.
I fix suggestions from #9.

drunken monkey’s picture

Status: Needs review » Fixed

OK, looks good. Thanks a lot!
Committed.
Thanks again, everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.