I’m getting the following errors when I try to display a date range facet block:
Error message

For some reason, the block displayed once when I removed the facet sort criteria. In that case the error was about missing a value required to create facet labels. I have not been able to get the block to display again.

The error occurs when the global settings for the facet are being loaded. Not sure why this is done, since date ranges are part of the block settings for the facet.

CommentFileSizeAuthor
error.png46.4 KBDarren Oh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Darren Oh’s picture

Issue summary: View changes
eugene.ilyin’s picture

I tried to reproduce this problem but I cannot. And I cannot solve problem which is not reproduced :(

eugene.ilyin’s picture

Status: Active » Postponed (maintainer needs more info)
davmorr’s picture

I think the version - 7.x-1.x-dev - was mis-labeled on this issue, unless version 7.x-1.0-beta2 was in -dev when this issue was posted and the issue never got fixed prior to be rolled out as -beta2 (released 2013-Aug-09). (the -dev version of this module is '7.x-1.0-beta2+10-dev' at the time of this writing).

In version 7.x-1.0-beta2, the function signature of date_facets_get_ranges($ranges) [date_facets.module - line 80] does not provide a default value. Only in the Search API DateRangeQueryType.php adapter plugin class file is the argument left out in this function call from the build() member function: $build = date_facets_get_ranges(); [line 59]

Note: the above class file for the core Search and Apachesolr adapter plugins make the call correctly: $build = date_facets_get_ranges($ranges);

There are additional issues in the Search API implementation in -beta2 . Since there is no $ranges value set in the aforementioned build() member function, I tried setting a default NULL value in the date_facets_get_ranges() function, using the date_facets_default_ranges() function:

function date_facets_get_ranges($ranges=NULL) {
  if(!$ranges) $ranges = date_facets_default_ranges();
  ...
}

... but the build() function crashes again when looking for an array key - '#time_interval' - in the date_facets_get_ranges() function return value array.

I can only guess that the more recent priority of efforts with the 7.x version of this module have been focused elsewhere, maybe in the Apachesolr and or core Search integration(s). The only version that I can get working properly with Search API is 7.x-1.0-beta1, with one of the issue 1834998 patches applied - not sure which version - and I added a two alter hooks (one to date_facets.module -> date_facets_get_ranges() and one to [Search API] DateRangeQueryType.php -> Drupal_Apachesolr_Facetapi_QueryType_DateRangeQueryType::getFacetItems() functions) to allow custom date spans to be added and or existing ones modified.

I think that this later version of this issue patch may contain everything, including the hooks that I added separately: https://drupal.org/files/search-api-support-1834998-7234076_3.patch.

Note: this is not the patch that I applied - 1834998-search-api-support_1.patch - that worked. I couldn't find the patch I applied in the issue queue (may have been removed), but the one listed above seemed to be accepted by the respondents in the thread.

ericsol’s picture

I can reproduce the error with 1.0-beta2. With 1.x-dev the block with date range filter does not appear at all. I'm working in a pretty basic setup trying to set a default date range facet for post dates of nodes but with PostgreSQL 9.2 as the Drupal and search server which might explain the lack of reproducibility. I am having difficulties with the price range facets in Commerce Kickstart with PostgreSQL too...
From some debugging in the code I get the impression this module assumes SOLR integration? Most of the functions return an empty array, except for $build which outputs the default ranges.

hope this helps somewhat...
eric

davmorr’s picture

ericsol:
I don't believe that the Date Facets module assumes SOLR as the backend, rather it provides adapters/handlers for several search backend integration modules out of the box - namely Apachesolr, core Search, and Search API. There is no PostgreSQL support out of the box, and even the Search API support seems like a bit of than afterthought, but what you may want to consider is looking into plugging it into the Search API as a handler and writing/acquiring (if exists) a Search API PostgreSQL integration module . Search API does not provide out of the box support for PostgreSQL, but there may be some initiatives and or sandbox projects dedicated to PostgreSQL integration.

I wasn't able to find anything in my quick two minute search attempt, but you may have better luck with a little more effort applied. I have not written Search API handler myuself, but if you or someone else were to write a Search API handler for PostgreSQL you may have better luck with the Date Facets module. I wouldn't know where to begin with PostgreSQL, but you could look at the documentation, examples and class code in the Search API and Search API Solr modules for reference.

Note: As mentioned, the Search API support is pretty dodgy, and I would not recommend installing the current version of this module (7.x-1.0-beta2, as of this writing - 3/6/14) - it actually broke more things than it fixed. You are better off using version 7.x-1.0-beta1 with the above patch applied until the Search API support stabilizes. There appears to be some activity in the -dev branch, but last time I played with it, it still wasn't ready for prime time.

Cheers!

cristian100’s picture

I can reproduce this, this happens when using date_facet module along with module "Facet API Pretty Paths" module. I which they could play along.

Darren Oh’s picture

Status: Postponed (maintainer needs more info) » Active
eugene.ilyin’s picture

I reproduced these errors http://i.imgur.com/wx1UKJG.png. You too?

  • Commit 17b2758 on 7.x-1.x by eugene.ilyin:
    Issue #2125599 Missing argument 1 for date_facets_get_ranges
    
eugene.ilyin’s picture

Assigned: Darren Oh » Unassigned
Status: Active » Fixed

Seems I solved these errors. Can somebody check last dev version?

Status: Fixed » Closed (fixed)

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

ron_s’s picture

Status: Closed (fixed) » Patch (to be ported)

What happened to this commit?

I'm looking at the latest -dev branch and 1.0 release, and neither has the execute() code any longer:
http://cgit.drupalcode.org/date_facets/commit/?id=17b2758
http://cgit.drupalcode.org/date_facets/tree/lib/Drupal/Facetapi/Widget/D...

Current code:
http://cgit.drupalcode.org/date_facets/tree/lib/Drupal/Facetapi/Widget/D...

I've been waiting for a year for this to be added to a new release, and now I find it's not in 1.0 (or 1.x-dev) at all. Has this been fixed a different way? We were getting lots of errors due to a conflict with the Facet API Pretty Paths module without this commit.

eugene.ilyin’s picture

Hi, according to this comment this method is not need.
Problem is not reproduced for me.
If you will have this problem, please open new issue.

eugene.ilyin’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

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