Hi there!

We have about 10000 group-nodes.

When setting up "OG Reference" as the widget for "og_group_ref" and using "Autocomplete" for the selection it self, we get a lot of queries. This leads to a page load time which is way to high.(30+s)
The load of queries are done on call of the edit-page of member-nodes and when typing into the autocomplete field.

When I use the "Autocomplete" widget instead of "OG Reference" everything works just fine.

I was just able to point it down to the call in og.field.inc line 112

$valid_ids = $other_groups_ids ? entityreference_get_selection_handler($field, $mocked_instance, $entity_type, $dummy_entity)->validateReferencableEntities($other_groups_ids) : array();

Skipping this line leads to less queries, but i'm not sure if thats really because of this line... or a consequence of the empty array...

Any ideas where to look to fix this?

(I searched the issue-queue for this but couldn't find anything what seemed related. So... if this is a duplicate one fo the 2000 issues, sorry for that :D)

Comments

SerkanB’s picture

Just realized: When I use the Autocomplete widget instead of "OG Reference" I can't save the field-instance-settings (admin/structure/types/manage/$node_type/fields/og_group_ref). I get a "FieldValidationException", where the message is "The referenced group ($node_type: ) is invalid."... because the default-value of the field is empty.

Am I even supposed to use anything else than the "OG Reference" widget?

SerkanB’s picture

Well, the issue mentioned in #1 is fixed by adding

    if(empty($item['target_id'])) {
      return;
    }

to OgBehaviorHandler::validate() after

  $item = reset($items); // line 254

But thats... kind of another issue.