Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/query/AlmanacServiceSearchEngine.php
Show All 10 Lines | public function getApplicationClassName() { | ||||
return 'PhabricatorAlmanacApplication'; | return 'PhabricatorAlmanacApplication'; | ||||
} | } | ||||
public function newQuery() { | public function newQuery() { | ||||
return new AlmanacServiceQuery(); | return new AlmanacServiceQuery(); | ||||
} | } | ||||
public function newResultObject() { | public function newResultObject() { | ||||
// NOTE: We need to attach a service type in order to generate custom | return AlmanacService::initializeNewService(); | ||||
// field definitions. | |||||
return AlmanacService::initializeNewService() | |||||
->attachServiceType(new AlmanacCustomServiceType()); | |||||
} | } | ||||
protected function buildQueryFromParameters(array $map) { | protected function buildQueryFromParameters(array $map) { | ||||
$query = $this->newQuery(); | $query = $this->newQuery(); | ||||
if ($map['match'] !== null) { | |||||
$query->withNameNgrams($map['match']); | |||||
} | |||||
return $query; | return $query; | ||||
} | } | ||||
protected function buildCustomSearchFields() { | protected function buildCustomSearchFields() { | ||||
return array(); | return array( | ||||
id(new PhabricatorSearchTextField()) | |||||
->setLabel(pht('Name Contains')) | |||||
->setKey('match') | |||||
->setDescription(pht('Search for services by name substring.')), | |||||
); | |||||
} | } | ||||
protected function getURI($path) { | protected function getURI($path) { | ||||
return '/almanac/service/'.$path; | return '/almanac/service/'.$path; | ||||
} | } | ||||
protected function getBuiltinQueryNames() { | protected function getBuiltinQueryNames() { | ||||
$names = array( | $names = array( | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |