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

Provide ApplicationSearch hooks in Maniphest

Summary: Ref T418. Adds hooks to support customized ApplicationSearch (you can't currently add indexable fields without writing custom code).

Test Plan: Wrote custom code to add an indexable field.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T418

Differential Revision: https://secure.phabricator.com/D7002
This commit is contained in:
epriestley 2013-09-16 16:03:09 -07:00
parent dd4537edef
commit ed126cd47e
3 changed files with 24 additions and 5 deletions

View file

@ -718,22 +718,25 @@ final class ManiphestTaskQuery
break;
}
$joins[] = $this->buildApplicationSearchJoinClause($conn_r);
return implode(' ', $joins);
}
private function buildGroupClause(AphrontDatabaseConnection $conn_r) {
$joined_multiple_project_rows = (count($this->projectPHIDs) > 1) ||
(count($this->anyProjectPHIDs) > 1);
$joined_multiple_rows = (count($this->projectPHIDs) > 1) ||
(count($this->anyProjectPHIDs) > 1) ||
($this->getApplicationSearchMayJoinMultipleRows());
$joined_project_name = ($this->groupBy == self::GROUP_PROJECT);
// If we're joining multiple rows, we need to group the results by the
// task IDs.
if ($joined_multiple_project_rows) {
if ($joined_multiple_rows) {
if ($joined_project_name) {
return 'GROUP BY task.id, projectGroup.projectPHID';
return 'GROUP BY task.phid, projectGroup.projectPHID';
} else {
return 'GROUP BY task.id';
return 'GROUP BY task.phid';
}
} else {
return '';
@ -950,4 +953,8 @@ final class ManiphestTaskQuery
));
}
protected function getApplicationSearchObjectPHIDColumn() {
return 'task.phid';
}
}

View file

@ -3,6 +3,10 @@
final class ManiphestTaskSearchEngine
extends PhabricatorApplicationSearchEngine {
public function getCustomFieldObject() {
return new ManiphestTask();
}
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
@ -62,6 +66,8 @@ final class ManiphestTaskSearchEngine
$saved->setParameter('limit', $limit);
}
$this->readCustomFieldsFromRequest($request, $saved);
return $saved;
}
@ -155,6 +161,8 @@ final class ManiphestTaskSearchEngine
$query->withDateCreatedBefore($end);
}
$this->applyCustomFieldsToQuery($query, $saved);
return $query;
}
@ -308,6 +316,8 @@ final class ManiphestTaskSearchEngine
->setLabel(pht('Task IDs'))
->setValue(implode(', ', $ids)));
$this->appendCustomFieldsToForm($form, $saved);
$this->buildDateRange(
$form,
$saved,

View file

@ -266,6 +266,8 @@ final class PhabricatorPeopleQuery
$this->nameLike);
}
$where[] = $this->buildPagingClause($conn_r);
return $this->formatWhereClause($where);
}