diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index dc2847d..ee62864 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -1688,7 +1688,10 @@ function taxonomy_field_presave($entity_type, $entity, $field, $instance, $langc function taxonomy_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items) { // We maintain a denormalized table of term/node relationships, containing // only data for current, published nodes. - if (variable_get('taxonomy_maintain_index_table', TRUE) && $field['storage']['type'] == 'field_sql_storage' && $entity_type == 'node' && $entity->status) { + if (variable_get('taxonomy_maintain_index_table', TRUE) + && $field['storage']['type'] == 'field_sql_storage' + && $entity_type == 'node' + && ($entity->status || variable_get('taxonomy_index_unpublished', FALSE))) { $query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created', )); foreach ($items as $item) { $query->values(array( @@ -1717,7 +1720,7 @@ function taxonomy_field_update($entity_type, $entity, $field, $instance, $langco db_delete('taxonomy_index')->condition('nid', $entity->nid)->execute(); } // Only save data to the table if the node is published. - if ($entity->status) { + if ($entity->status || variable_get('taxonomy_index_unpublished', FALSE)) { $query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created')); foreach ($items as $item) { $query->values(array(