1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

When running a fulltext query with no query, enforce order by document creation date

Summary:
Fixes T11929. When running with a query, we no longer enforce an order on the subquery join to produce results more quickly when searching for common strings.

However, this means that empty queries (like those issued by "Close as Duplicate") don't order subquery results.

Restore a `dateCreated` order if there is no query text.

Test Plan: Artificially set limit to 10, still saw 10 most recent tasks.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11929

Differential Revision: https://secure.phabricator.com/D16960
This commit is contained in:
epriestley 2016-11-29 10:38:38 -08:00
parent 2d7abfd9fa
commit 23a202866a

View file

@ -347,13 +347,24 @@ final class PhabricatorMySQLFulltextStorageEngine
$where = ''; $where = '';
} }
if (strlen($compiled_query)) {
$order = '';
} else {
// When not executing a query, order by document creation date. This
// is the default view in object browser dialogs, like "Close Duplicate".
$order = qsprintf(
$conn,
'ORDER BY document.documentCreated DESC');
}
return qsprintf( return qsprintf(
$conn, $conn,
'SELECT %Q FROM %T document %Q %Q LIMIT 1000', 'SELECT %Q FROM %T document %Q %Q %Q LIMIT 1000',
$select, $select,
$document_table, $document_table,
$join, $join,
$where); $where,
$order);
} }
protected function joinRelationship( protected function joinRelationship(