mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
Correct some straggling Ferret/Cursor interactions
Summary: See PHI1182. Ref T13266. The recent fixes didn't quite cover the case where you have a query, but order by something other than relevance, and page forward. Refine the tests around building/selecting these columns and paging values a little bit to be more specific about what they care about. Test Plan: Executed queries, then went to "Next Page", for: - query text, non-relevance order. - query text, relevance order. - no query text, non-relevance order. - no query text, relevance order. Also, made an API call similar to the one in PHI1182. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13266 Differential Revision: https://secure.phabricator.com/D20354
This commit is contained in:
parent
ea182b6df9
commit
00b1c4190c
1 changed files with 23 additions and 4 deletions
|
@ -212,7 +212,7 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->supportsFerretEngine()) {
|
if ($this->supportsFerretEngine()) {
|
||||||
if ($this->getFerretTokens()) {
|
if ($this->hasFerretOrder()) {
|
||||||
$map += array(
|
$map += array(
|
||||||
'rank' =>
|
'rank' =>
|
||||||
$cursor->getRawRowProperty(self::FULLTEXT_RANK),
|
$cursor->getRawRowProperty(self::FULLTEXT_RANK),
|
||||||
|
@ -1840,15 +1840,16 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
return $select;
|
return $select;
|
||||||
}
|
}
|
||||||
|
|
||||||
$vector = $this->getOrderVector();
|
if (!$this->hasFerretOrder()) {
|
||||||
if (!$vector->containsKey('rank')) {
|
// We only need to SELECT the virtual rank/relevance columns if we're
|
||||||
// We only need to SELECT the virtual "_ft_rank" column if we're
|
|
||||||
// actually sorting the results by rank.
|
// actually sorting the results by rank.
|
||||||
return $select;
|
return $select;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->ferretEngine) {
|
if (!$this->ferretEngine) {
|
||||||
$select[] = qsprintf($conn, '0 AS %T', self::FULLTEXT_RANK);
|
$select[] = qsprintf($conn, '0 AS %T', self::FULLTEXT_RANK);
|
||||||
|
$select[] = qsprintf($conn, '0 AS %T', self::FULLTEXT_CREATED);
|
||||||
|
$select[] = qsprintf($conn, '0 AS %T', self::FULLTEXT_MODIFIED);
|
||||||
return $select;
|
return $select;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3152,4 +3153,22 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function hasFerretOrder() {
|
||||||
|
$vector = $this->getOrderVector();
|
||||||
|
|
||||||
|
if ($vector->containsKey('rank')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($vector->containsKey('fulltext-created')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($vector->containsKey('fulltext-modified')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue