Skip to content

Commit 1d213dc

Browse files
author
epriestley
committed
Clean up virtual "_ft_rank" column for query construction of Ferret objects
Summary: Ref T12974. Ferret object queries SELECT a virtual "_ft_rank" column for relevance ordering. Currently, they always SELECT this column. That's fine and doesn't hurt anything, but makes developing and debugging things kind of a pain since every query has this `, blah blah _ft_rank` junk. Instead, construct this column only if we're actually going to use it. Mostly, this cleans up DarkConsole / query logs a bit. Test Plan: Viewed normal query results on various pages, viewed global search results, ordered Maniphest tasks by normal stuff and by "Relevance". Viewed DarkConsole, saw no more "_ft_rank" junk on normal pages. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T12974 Differential Revision: https://secure.phabricator.com/D18728
1 parent 683df39 commit 1d213dc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,13 @@ protected function buildFerretSelectClause(AphrontDatabaseConnection $conn) {
15651565
return $select;
15661566
}
15671567

1568+
$vector = $this->getOrderVector();
1569+
if (!$vector->containsKey('rank')) {
1570+
// We only need to SELECT the virtual "_ft_rank" column if we're
1571+
// actually sorting the results by rank.
1572+
return $select;
1573+
}
1574+
15681575
if (!$this->ferretEngine) {
15691576
$select[] = '0 _ft_rank';
15701577
return $select;

0 commit comments

Comments
 (0)