Recoverable fatal error: Argument 2 passed to search_api_facetapi_facet_map_callback() must be an array, string given in search_api_facetapi_facet_map_callback() (line 250 of /data/disk/o1/distro/001/drupal-7.22.1-prod/sites/domain.com/modules/search_api/contrib/search_api_facetapi/search_api_facetapi.module).

get this when I enable the facted block "changed".
It is right configured.

I use the search api module.

Comments

maximpodorov’s picture

Priority: Major » Critical
Status: Active » Needs review

This patch fixes the problem for me:

--- date_facets.module.orig     2013-08-11 13:04:21.000000000 +0400
+++ date_facets.module  2013-08-16 13:48:12.943388234 +0400
@@ -43,7 +43,7 @@
       $facet_info[$name]['query types'][] = 'date_range';
       // This widget needs a different way to set labels
       // so we add our own callback.
-      $facet_info[$name]['map options'] = '_date_facets_api_facet_create_label';
+      $facet_info[$name]['map options']['value callback'] = '_date_facets_api_facet_create_label';
       $facet_info[$name]['query types'][] = 'date_range';
     }
   }
muschpusch’s picture

Status: Needs review » Reviewed & tested by the community

yep works!

muschpusch’s picture

Status: Reviewed & tested by the community » Needs work

ok i was to quick... the fatal error is gone but no label is shown when adding custom facet ranges...

maximpodorov’s picture

But labels for the standard ranges are shown.

bennos’s picture

can confirm #3 and #4.
error is away, but labels of new added individual timeframes are not shown.

eugene.ilyin’s picture

Status: Needs work » Postponed (maintainer needs more info)

Hello.

I used this variant (7.x-1.x-dev)

$facet_info[$name]['map options'] = '_date_facets_api_facet_create_label';

and search_api 7.x-1.7. Problem is not reproduced when I enabled new facet (created or changed).

P.S. I did changes in this line according to this issue https://drupal.org/node/2016601

boabjohn’s picture

Title: Unrecover » Recoverable error: string vs array passed to facet_map_callback

Sorry I might be off the rails here, but I'm still getting the error. My lines look like this:

      // This widget needs a different way to set labels
      // so we add our own callback.
      $facet_info[$name]['map options'] = '_date_facets_api_facet_create_label';
      $facet_info[$name]['query types'][] = 'date_range';

which is a combination of the original patch at #1 with the variant at #6...
What should I be doing?
(title updated for better relevance)

Using search_api 7.x-1.7

boabjohn’s picture

Status: Postponed (maintainer needs more info) » Active

Hi guys,
The variant at #6 still produced the same error.
The pair of lines from #1 is working (for us):

$facet_info[$name]['map options']['value callback'] = '_date_facets_api_facet_create_label';
       $facet_info[$name]['query types'][] = 'date_range';

If more information is needed I'm happy to provide more details.
For now we have simply stopped using the module.

jantoine’s picture

After investigating I found that this module does not yet support custom date ranges, even though it will let you create them. This is where most the errors seem to be coming from. I was able to clear up all errors by downloading the dev version of this module, applying the fix found in #1 and by restoring the default date ranges.

jantoine’s picture

Status: Active » Needs work
StatusFileSize
new619 bytes

Here is a patch file with the fix from #1. After investigating the Search API module's code, 'map callback' also seems to work. Since I am not sure which one is correct, this most likely still needs some work.

eugene.ilyin’s picture

Hello. Sorry for delay.
Thanks all for your suggestions, but how I can reproduce this bug? I enabled facet by field "changed" and for me all works fine http://i.imgur.com/0H7nmIj.png

eugene.ilyin’s picture

Status: Needs work » Fixed

I found way for reproduce this problem. You should unset all checkboxes of sorting http://i.imgur.com/q8AuTDo.png and save facet form. After that I got error on search results page:

Recoverable fatal error: Argument 2 passed to search_api_facetapi_facet_map_callback() must be an array, string given in search_api_facetapi_facet_map_callback() (line 250 of /data/disk/o1/distro/001/drupal-7.22.1-prod/sites/domain.com/modules/search_api/contrib/search_api_facetapi/search_api_facetapi.module).

You should apply patch from #10 and submit you facet edit form again.

Commited a04658a

Status: Fixed » Closed (fixed)

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