Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->load() (line 203 of /var/www/sites/all/modules/entity/includes/entity.controller.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController->cacheGet() (line 297 of /var/www/sites/all/modules/entity/includes/entity.controller.inc).

Haven't debugged why this occurs, but it is reproducible by adding a facets block display to a view with a Search: Search Terms argument, and then saving the view.

/Robin

Comments

drunken monkey’s picture

StatusFileSize
new780 bytes

Sorry, but I can't reproduce this. For me, this works like expected. (I assume you meant the "Search: Fulltext search" argument?)
It would be nice if you could help me find the bug by first applying the attached patch, then triggering the bug and sending me the message output (which will hopefully be there).
In general, the sources of such warnings (I've seen them quite often already) are wrong calls to entity_load() or its derivatives (in this case, most probably search_api_index_load()).

davidseth’s picture

I get the same error as the original poster. Here is the debug output attached.

davidseth’s picture

StatusFileSize
new313.21 KB

sorry, file now actually attached.

drunken monkey’s picture

OK, thank you!
I can see now that this can be caused by someone adding the "Facets block" display to a view with a wrong base table – i.e., one not representing a Search API index. Then, the plugin will (of course) fail in loading the corresponding search index, causing the mentioned warning. This should in any case be fixed to throw an exception with a more meaningful error message.

However, I assume that you are using a correct base table, for a search index? If so, please apply the attached patch to the Search API and post the resulting message when triggering the error. It should now throw an exception, but underneath that display an info message prefixed with "DEBUG".

By the way, just saw I forgot to mention that the previous patch should be applied to the Entity API module, not to the Search API. Sorry for that!

davidseth’s picture

StatusFileSize
new18.77 KB

Okay, applied the patch at #4.

DEBUG: views base table: search_api_index
Error messageSearchApiException: The "Facets block" display cannot be used with a view for Search index. Please only use this display with base tables representing search indexes. in SearchApiViewsFacetsBlockDisplay->getFieldOptions() (line 110 of /Users/david/web/nailsma-hg/nailsma/htdocs/sites/all/modules/contrib/search_api/contrib/search_api_views/includes/display_facet_block.inc).

You are right, I had applied this to a base table of search_index. Sorry, my fault. I will switch it to use my Node index that I created.

Okay, after I have done this, it indeed works (kinda). I get the facets, but instead of the term names, I get the term ID. Attached is a screen shot.

Thanks.

drunken monkey’s picture

Title: Array_flip warning when saving a view with facet block display » Inadequate warnings when using the "Facets block" display with wrong base table
Status: Active » Fixed

This is an entirely different problem, that should go into a new issue. Please mention there, which field you use for the facets, and other circumstances that might influence this.

This issue is fixed, I now committed the above patch minus the debug lines, so wrong useage will now result in a more meaningful error message.

Status: Fixed » Closed (fixed)

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