Commit 72040dbe authored by catch's avatar catch

Issue #610076 by fietserwin, yingtho, te-brian, mikeryan, Dave Cohen: Add a...

Issue #610076 by fietserwin, yingtho, te-brian, mikeryan, Dave Cohen: Add a primary key to the {taxonomy_index} table and prevent duplicates being inserted.
parent eca1d75e
......@@ -800,16 +800,12 @@ function taxonomy_build_node_index($node) {
}
// Insert index entries for all the node's terms.
if (!empty($tid_all)) {
$query = db_insert('taxonomy_index')->fields(array('nid', 'tid', 'sticky', 'created'));
foreach ($tid_all as $tid) {
$query->values(array(
'nid' => $node->id(),
'tid' => $tid,
'sticky' => $sticky,
'created' => $node->getCreatedTime(),
));
db_merge('taxonomy_index')
->key(array('nid' => $node->id(), 'tid' => $tid))
->fields(array('sticky' => $sticky, 'created' => $node->getCreatedTime()))
->execute();
}
$query->execute();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment