apachesolr_node_type_insert() with a new node type was leading to a duplicate key error. This is due to the drupal_array_merge_deep() call in apachesolr_load_all_environments().

 }
  print_r($environments);

  // Allow overrides of environments from settings.php
  $conf_environments = variable_get('apachesolr_environments', array());
  if (!empty($conf_environments)) {
    $environments = drupal_array_merge_deep($environments, $conf_environments);
  }
  print_r($environments);

If you have:

$conf['apachesolr_environments']['solr']['index_bundles'] = array(
  'node' => array('some_node_type')
);

and the node type is already configured, the drupal_array_merge_deep() call makes it appear twice in the array. Then from there, it's added twice to the db_insert() that writes to apachesolr_index_bundles().

CommentFileSizeAuthor
#3 2023151-2.patch544 bytespwolanin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pwolanin’s picture

So, seems like a fix would be to change to:


'node' => array('some_node_type' => 'some_node_type')

or otherwise make the bundle name the array key (rather than numeric keys)?

catch’s picture

Yes that'd work fine.

pwolanin’s picture

Status: Active » Needs review
FileSize
544 bytes

This might be at least the start of the fix - not sure if it will break existing ctools exports.

Nick_vh’s picture

We need some people with active exports to review this patch before we commit this. Catch can you confirm and mark it as RTBC perhaps?

Nick_vh’s picture

Issue summary: View changes

Updated issue summary.

eyeless’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Tested paired with Acquia Search, so the environment is re-saved on each cron run. Not seeing a duplicate entry error any more.

  • japerry committed 7846ddd on 7.x-1.x authored by pwolanin
    Issue #2023151 by pwolanin: apachesolr_load_all_environments()...
japerry’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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