Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/engine/PhabricatorSearchEngineAPIMethod.php
<?php | <?php | ||||
abstract class PhabricatorSearchEngineAPIMethod | abstract class PhabricatorSearchEngineAPIMethod | ||||
extends ConduitAPIMethod { | extends ConduitAPIMethod { | ||||
abstract public function newSearchEngine(); | abstract public function newSearchEngine(); | ||||
final public function getQueryMaps($query) { | |||||
$maps = $this->getCustomQueryMaps($query); | |||||
// Make sure we emit empty maps as objects, not lists. | |||||
foreach ($maps as $key => $map) { | |||||
if (!$map) { | |||||
$maps[$key] = (object)$map; | |||||
} | |||||
} | |||||
return $maps; | |||||
} | |||||
protected function getCustomQueryMaps($query) { | |||||
return array(); | |||||
} | |||||
public function getApplication() { | public function getApplication() { | ||||
$engine = $this->newSearchEngine(); | $engine = $this->newSearchEngine(); | ||||
$class = $engine->getApplicationClassName(); | $class = $engine->getApplicationClassName(); | ||||
return PhabricatorApplication::getByClass($class); | return PhabricatorApplication::getByClass($class); | ||||
} | } | ||||
public function getMethodStatus() { | public function getMethodStatus() { | ||||
return self::METHOD_STATUS_UNSTABLE; | return self::METHOD_STATUS_UNSTABLE; | ||||
Show All 15 Lines | abstract class PhabricatorSearchEngineAPIMethod | ||||
final protected function defineReturnType() { | final protected function defineReturnType() { | ||||
return 'map<string, wild>'; | return 'map<string, wild>'; | ||||
} | } | ||||
final protected function execute(ConduitAPIRequest $request) { | final protected function execute(ConduitAPIRequest $request) { | ||||
$engine = $this->newSearchEngine() | $engine = $this->newSearchEngine() | ||||
->setViewer($request->getUser()); | ->setViewer($request->getUser()); | ||||
return $engine->buildConduitResponse($request); | return $engine->buildConduitResponse($request, $this); | ||||
} | } | ||||
final public function getMethodDescription() { | final public function getMethodDescription() { | ||||
return pht( | return pht( | ||||
'This is a standard **ApplicationSearch** method which will let you '. | 'This is a standard **ApplicationSearch** method which will let you '. | ||||
'list, query, or search for objects. For documentation on these '. | 'list, query, or search for objects. For documentation on these '. | ||||
'endpoints, see **[[ %s | Conduit API: Using Search Endpoints ]]**.', | 'endpoints, see **[[ %s | Conduit API: Using Search Endpoints ]]**.', | ||||
PhabricatorEnv::getDoclink('Conduit API: Using Edit Endpoints')); | PhabricatorEnv::getDoclink('Conduit API: Using Edit Endpoints')); | ||||
▲ Show 20 Lines • Show All 527 Lines • Show Last 20 Lines |