When I'm submitting the creation form to create a new index of any of the denormalized item types I get the following error:

Fatal error: Unsupported operand types in /var/www/oam6/sites/all/modules/search_api_grouping/includes/datasource_denormalized_entity.inc on line 248 Call Stack:
0.0012 663392 1. {main}() /var/www/oam6/index.php:0
0.3369 49924856 2. menu_execute_active_handler(???, ???) /var/www/oam6/index.php:21
0.3434 50840672 3. call_user_func_array(???, ???) /var/www/oam6/includes/menu.inc:517
0.3434 50841288 4. drupal_get_form(???, ???) /var/www/oam6/includes/menu.inc:0
0.3434 50842688 5. drupal_build_form(???, ???) /var/www/oam6/includes/form.inc:131
0.3651 52481144 6. drupal_process_form(???, ???, ???) /var/www/oam6/includes/form.inc:374
0.3695 52553968 7. form_execute_handlers(???, ???, ???) /var/www/oam6/includes/form.inc:860
0.3696 52559208 8. search_api_admin_index_status_form_submit(???, ???) /var/www/oam6/includes/form.inc:1464
0.3697 52559488 9. SearchApiIndex->clear() /var/www/oam6/profiles/openaidmap/modules/contrib/search_api/search_api.admin.inc:977
0.3822 53815256 10. _search_api_index_reindex(???) /var/www/oam6/profiles/openaidmap/modules/contrib/search_api/includes/index_entity.inc:333
0.3822 53815848 11. SearchApiDenormalizedEntityDataSourceController->trackItemChange(???, ???, ???) /var/www/oam6/profiles/openaidmap/modules/contrib/search_api/search_api.module:2095
0.3894 54031936 12. SearchApiDenormalizedEntityDataSourceController->createPermutationItems(???, ???, ???) /var/www/oam6/sites/all/modules/search_api_grouping/includes/datasource_denormalized_entity.inc:202

Syslog provides more precise information:

Warning: array_fill(): Number of elements must be positive in SearchApiDenormalizedEntityDataSourceController->createPermutationItems() (line 248 of .../sites/all/modules/search_api_grouping/includes/datasource_denormalized_entity.inc).

and

Warning: array_combine() expects parameter 2 to be array, boolean given in SearchApiDenormalizedEntityDataSourceController->createPermutationItems() (line 248 of .../sites/all/modules/search_api_grouping/includes/datasource_denormalized_entity.inc).

Clearly count($ids) is 0.

This can be traced back to the fact that $denormalization_fields is empty on line 247.
$denormalization_fields is initialized on line 241.
It is initialized to an empty array because there are no processors on the index.

I'm using drupal-7.22, search_api-7.x-1.6, search_api_solr-7.x-1.1 and search_api_grouping-7.x-2.0-beta1.
So according to me the patches are installed. (Btw the part about the patches is very confusing.)
I'm perfectly well able to create an index on any of the non-denormalized item types.

Comments

Jan van Diepen’s picture

I patched the code a little bit, so I was able to actually create the index and configure it.
Initially I was not able to index the items because there were no items to be indexed.
After setting "the fields to use to denormalize the items to index" there were items to be indexed.
It seems that during creation of the index "the fields to use to denormalize the items to index" are queried and used to determine the items to be indexed.
Since there are no fields yet it will fail as described in the issue.

It should not be to difficult to write a patch for this.

malks’s picture

Hi,

I was seeing the same issue. Did you get it all working? I manually patched the offending code (it was trying to loop on normalized fields which haven't been set up at this stage) but still had trouble getting any of the functionality working correctly.

Thanks.

das-peter’s picture

Hmm, I'm not sure if I fully get the issue - and it would be nice to know what you've patched to get it working. Since it seems that your adjustments worked out.
However, I've pushed a change to avoid the error: http://drupalcode.org/project/search_api_grouping.git/commitdiff/974c8b3...

Let me know if this makes any difference.

kenorb’s picture

kenorb’s picture

texas-bronius’s picture

Please see the attached patch made against 7.x-2.0-beta1 to address (refresh?) comment #3 above which, when #3 linked patch was applied gave a gigantic screenful of debilitated pink for the db_update (see attached). Once applied, I was able to create the new index-- haven't tried beyond that yet :) Note: all this patch does is wrap to check for items to be thrown into db_update which, when empty, throws a bit fat PDO exception.

Patch attached.

das-peter’s picture

Status: Active » Fixed

@texas-bronius Thanks for the patch - applied, committed & published: http://drupalcode.org/project/search_api_grouping.git/commit/91560e471e4...
Congratulations to your first Search API Grouping patch.

Due the fact that there wasn't that much feedback on the patches so far I set this to fixed.
Feel free to re-open if you come across this issue again (don't forget to add a detailed information)

Status: Fixed » Closed (fixed)

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