Commit 9f92f4e0 authored by alexpott's avatar alexpott

Issue #735154 by jhodgdon, pwolanin: Fixed...

Issue #735154 by jhodgdon, pwolanin: Fixed search_touch_node()/search_mark_for_reindex() should not update if already touched.
parent 4e681e62
......@@ -184,6 +184,26 @@ function testMultilingualSearch() {
// Mark one node for reindexing by saving it, and verify indexing status.
$this->searchable_nodes[1]->save();
$this->assertIndexCounts(1, 3, 'after marking one node to reindex via save');
// The request time is always the same throughout test runs. Update the
// request time to a previous time, to simulate it having been marked
// previously.
$current = REQUEST_TIME;
$old = $current - 10;
db_update('search_dataset')
->fields(array('reindex' => $old))
->condition('reindex', $current, '>=')
->execute();
// Save the node again. Verify that the request time on it is not updated.
$this->searchable_nodes[1]->save();
$result = db_select('search_dataset', 'd')
->fields('d', array('reindex'))
->condition('type', 'node_search')
->condition('sid', $this->searchable_nodes[1]->id())
->execute()
->fetchField();
$this->assertEqual($result, $old, 'Reindex time was not updated if node was already marked');
}
/**
......
......@@ -535,6 +535,9 @@ function search_mark_for_reindex($type, $sid) {
->fields(array('reindex' => REQUEST_TIME))
->condition('type', $type)
->condition('sid', $sid)
// Only mark items that were not previously marked for reindex, so that
// marked items maintain their priority by request time.
->condition('reindex', 0)
->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