mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00: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:
parent
2d7abfd9fa
commit
23a202866a
1 changed files with 13 additions and 2 deletions
|
@ -347,13 +347,24 @@ final class PhabricatorMySQLFulltextStorageEngine
|
|||
$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(
|
||||
$conn,
|
||||
'SELECT %Q FROM %T document %Q %Q LIMIT 1000',
|
||||
'SELECT %Q FROM %T document %Q %Q %Q LIMIT 1000',
|
||||
$select,
|
||||
$document_table,
|
||||
$join,
|
||||
$where);
|
||||
$where,
|
||||
$order);
|
||||
}
|
||||
|
||||
protected function joinRelationship(
|
||||
|
|
Loading…
Reference in a new issue