The xmlsitemap_xmlsitemap_index_links($limit) function seems to be querying for something which is not exactly what it needs: within the internal loop, one finds:

      if ($entity_type->get('type')) {
        $query->condition('type', $entity_bundles, 'IN');
      }

And this always fails from what I've seen. It seems that the purpose is to filter the indexing by limiting it to only the selected bundles, calculated a bit higher in the code and set in $entity_bundles. Which makes me think this is an attempt to limit the query to node bundles, by (incorrectly) using hardcoded knowledge of the Node bundle key being called type, but which should more generally use the bundle key mapping, like:

      if ($entity_type->hasKey('bundle')) {
        $bundleKey = $entity_type->getKey('bundle');
        $query->condition($bundleKey, $entity_bundles, 'IN');
      }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fgm created an issue. See original summary.

fgm’s picture

Suggested patch attached.

Also, I think the exception caught out of this loop should probably log the fact that an exception occurred instead of muting the information, but this is another topic.

Dave Reid’s picture

Status: Active » Needs review
FileSize
714 bytes

It seemed redundant to have a variable for $bundle_name, so I removed that variable out and slimmed this down.

  • Dave Reid committed 9d7dd1f on 8.x-1.x
    Issue #2940681 by fgm, Dave Reid: Fixed query in...
Dave Reid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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