Page MenuHomeClusterLabs Projects
Diviner Tech Docs PhabricatorApplicationSearchEngine

abstract class PhabricatorApplicationSearchEngine
Phorge Technical Documentation (Search)

Represents an abstract search engine for an application. It supports creating and storing saved queries.

Tasks

Constructing Engines

  • public static function getAllEngines() — Load all available application search engines.
  • public static function getEngineByClassName($class_name) — Get an engine by class name, if it exists.

Applications

No methods for this task.

Builtin Queries

Query URIs

  • public function getQueryResultsPageURI($query_key) — Return an application URI corresponding to the results page of a query. Normally, this is something like `/application/query/QUERYKEY/`.
  • public function getQueryManagementURI() — Return an application URI for query management. This is used when, e.g., a query deletion operation is cancelled.
  • abstract protected function getURI($path) — Return the URI to a path within the application. Used to construct default URIs for management and results.

Date Filters

  • protected function parseDateTime($date_time)
  • protected function buildDateRange($form, $saved_query, $start_key, $start_name, $end_key, $end_name)

Result Ordering

No methods for this task.

Reading Utilities

  • protected function readUsersFromRequest($request, $key, $allow_types) — Read a list of user PHIDs from a request in a flexible way. This method supports either of these forms:
  • protected function readSubscribersFromRequest($request, $key) — Read a list of subscribers from a request in a flexible way.
  • protected function readPHIDsFromRequest($request, $key, $allow_types) — Read a list of generic PHIDs from a request in a flexible way. Like @{method:readUsersFromRequest}, this method supports either array or comma-delimited forms. Objects can be specified either by PHID or by object name.

Paging and Executing Queries

No methods for this task.

Rendering Results

No methods for this task.

Other Methods

Methods

public function setController($controller)

This method is not documented.
Parameters
PhabricatorController$controller
Return
wild

public function getController()

This method is not documented.
Return
wild

public function buildResponse()

This method is not documented.
Return
wild

public function newResultObject()

This method is not documented.
Return
wild

public function newQuery()

This method is not documented.
Return
wild

public function setViewer($viewer)

This method is not documented.
Parameters
PhabricatorUser$viewer
Return
wild

protected function requireViewer()

This method is not documented.
Return
wild

public function setContext($context)

This method is not documented.
Parameters
$context
Return
wild

public function isPanelContext()

This method is not documented.
Return
wild

public function setNavigationItems($navigation_items)

This method is not documented.
Parameters
array$navigation_items
Return
wild

public function getNavigationItems()

This method is not documented.
Return
wild

public function canUseInPanelContext()

This method is not documented.
Return
wild

public function saveQuery($query)

This method is not documented.
Parameters
PhabricatorSavedQuery$query
Return
wild

public function buildSavedQueryFromRequest($request)

Create a saved query object from the request.

Parameters
AphrontRequest$requestThe search request.
Return
PhabricatorSavedQuery

public function buildQueryFromSavedQuery($original)

Executes the saved query.

Parameters
PhabricatorSavedQuery$originalThe saved query to operate on.
Return
PhabricatorQueryThe result of the query.

protected function willUseSavedQuery($saved)

Hook for subclasses to adjust saved queries prior to use.

If an application changes how queries are saved, it can implement this hook to keep old queries working the way users expect, by reading, adjusting, and overwriting parameters.

Parameters
PhabricatorSavedQuery$savedSaved query which will be executed.
Return
void

protected function buildQueryFromParameters($parameters)

This method is not documented.
Parameters
array$parameters
Return
wild

public function buildSearchForm($form, $saved)

Builds the search form using the request.

Parameters
AphrontFormView$formForm to populate.
PhabricatorSavedQuery$savedThe query from which to build the form.
Return
void

protected function buildSearchFields()

This method is not documented.
Return
wild

protected function shouldShowOrderField()

This method is not documented.
Return
wild

private function adjustFieldsForDisplay($field_map)

This method is not documented.
Parameters
array$field_map
Return
wild

protected function buildCustomSearchFields()

This method is not documented.
Return
wild

protected function getDefaultFieldOrder()

Define the default display order for fields by returning a list of field keys.

You can use the special key ... to mean "all unspecified fields go here". This lets you easily put important fields at the top of the form, standard fields in the middle of the form, and less important fields at the bottom.

For example, you might return a list like this:

return array(
  'authorPHIDs',
  'reviewerPHIDs',
  '...',
  'createdAfter',
  'createdBefore',
);

Any unspecified fields (including custom fields and fields added automatically by infrastructure) will be put in the middle.

Return
list<string>Default ordering for field keys.

protected function getHiddenFields()

Return a list of field keys which should be hidden from the viewer.

Return
list<string>Fields to hide.

public function getErrors()

This method is not documented.
Return
wild

public function addError($error)

This method is not documented.
Parameters
$error
Return
wild

public function getQueryResultsPageURI($query_key)

Return an application URI corresponding to the results page of a query. Normally, this is something like /application/query/QUERYKEY/.

Parameters
string$query_keyThe query key to build a URI for.
Return
stringURI where the query can be executed.

public function getQueryManagementURI()

Return an application URI for query management. This is used when, e.g., a query deletion operation is cancelled.

Return
stringURI where queries can be managed.

public function getQueryBaseURI()

This method is not documented.
Return
wild

public function getExportURI($query_key)

This method is not documented.
Parameters
$query_key
Return
wild

public function getCustomizeURI($query_key, $object_phid, $context_phid)

This method is not documented.
Parameters
$query_key
$object_phid
$context_phid
Return
wild

abstract protected function getURI($path)

Return the URI to a path within the application. Used to construct default URIs for management and results.

Parameters
$path
Return
stringURI to path.

abstract public function getResultTypeDescription()

Return a human readable description of the type of objects this query searches for.

For example, "Tasks" or "Commits".

Return
stringHuman-readable description of what this engine is used to find.

public function newSavedQuery()

This method is not documented.
Return
wild

public function addNavigationItems($menu)

This method is not documented.
Parameters
PHUIListView$menu
Return
wild

public function loadAllNamedQueries()

This method is not documented.
Return
wild

public function loadEnabledNamedQueries()

This method is not documented.
Return
wild

public function getDefaultQueryKey()

This method is not documented.
Return
wild

protected function setQueryProjects($query, $saved)

This method is not documented.
Parameters
PhabricatorCursorPagedPolicyAwareQuery$query
PhabricatorSavedQuery$saved
Return
wild

protected function getApplicationURI($path)

This method is not documented.
Parameters
$path
Return
wild

protected function getApplication()

This method is not documented.
Return
wild

abstract public function getApplicationClassName()

This method is not documented.
Return
wild

public static function getAllEngines()

Load all available application search engines.

Return
list<PhabricatorApplicationSearchEngine>All available engines.

public static function getEngineByClassName($class_name)

Get an engine by class name, if it exists.

Parameters
$class_name
Return
PhabricatorApplicationSearchEngine|nullEngine, or null if it does not exist.

public function getBuiltinQueries()

This method is not documented.
Return
wild

public function getBuiltinQuery($query_key)

This method is not documented.
Parameters
$query_key
Return
wild

protected function getBuiltinQueryNames()

This method is not documented.
Return
wild

public function isBuiltinQuery($query_key)

This method is not documented.
Parameters
$query_key
Return
wild

public function buildSavedQueryFromBuiltin($query_key)

This method is not documented.
Parameters
$query_key
Return
wild

protected function readUsersFromRequest($request, $key, $allow_types)

Read a list of user PHIDs from a request in a flexible way. This method supports either of these forms:

users[]=alincoln&users[]=htaft
users=alincoln,htaft

Additionally, users can be specified either by PHID or by name.

The main goal of this flexibility is to allow external programs to generate links to pages (like "alincoln's open revisions") without needing to make API calls.

Parameters
AphrontRequest$requestRequest to read user PHIDs from.
string$keyKey to read in the request.
list<const>$allow_typesOther permitted PHID types.
Return
list<phid>List of user PHIDs and selector functions.

protected function readSubscribersFromRequest($request, $key)

Read a list of subscribers from a request in a flexible way.

Parameters
AphrontRequest$requestRequest to read PHIDs from.
string$keyKey to read in the request.
Return
list<phid>List of object PHIDs.

protected function readPHIDsFromRequest($request, $key, $allow_types)

Read a list of generic PHIDs from a request in a flexible way. Like readUsersFromRequest(), this method supports either array or comma-delimited forms. Objects can be specified either by PHID or by object name.

Parameters
AphrontRequest$requestRequest to read PHIDs from.
string$keyKey to read in the request.
list<const>$allow_typesOptional, list of permitted PHID types.
Return
list<phid>List of object PHIDs.

protected function readListFromRequest($request, $key)

Read a list of items from the request, in either array format or string format:

list[]=item1&list[]=item2
list=item1,item2

This provides flexibility when constructing URIs, especially from external sources.

Parameters
AphrontRequest$requestRequest to read strings from.
string$keyKey to read in the request.
Return
list<string>List of values.

protected function readBoolFromRequest($request, $key)

This method is not documented.
Parameters
AphrontRequest$request
$key
Return
wild

protected function getBoolFromQuery($query, $key)

This method is not documented.
Parameters
PhabricatorSavedQuery$query
$key
Return
wild

protected function parseDateTime($date_time)

This method is not documented.
Parameters
$date_time
Return
wild

protected function buildDateRange($form, $saved_query, $start_key, $start_name, $end_key, $end_name)

This method is not documented.
Parameters
AphrontFormView$form
PhabricatorSavedQuery$saved_query
$start_key
$start_name
$end_key
$end_name
Return
wild

protected function newResultBuckets()

This method is not documented.
Return
wild

public function getResultBucket($saved)

This method is not documented.
Parameters
PhabricatorSavedQuery$saved
Return
wild

public function getPageSize($saved)

This method is not documented.
Parameters
PhabricatorSavedQuery$saved
Return
wild

public function shouldUseOffsetPaging()

This method is not documented.
Return
wild

public function newPagerForSavedQuery($saved)

This method is not documented.
Parameters
PhabricatorSavedQuery$saved
Return
wild

public function executeQuery($query, $pager)

This method is not documented.
Parameters
PhabricatorPolicyAwareQuery$query
AphrontView$pager
Return
wild

protected function didExecuteQuery($query)

This method is not documented.
Parameters
PhabricatorPolicyAwareQuery$query
Return
wild

public function setRequest($request)

This method is not documented.
Parameters
AphrontRequest$request
Return
wild

public function getRequest()

This method is not documented.
Return
wild

public function renderResults($objects, $query)

This method is not documented.
Parameters
array$objects
PhabricatorSavedQuery$query
Return
wild

protected function getRequiredHandlePHIDsForResultList($objects, $query)

This method is not documented.
Parameters
array$objects
PhabricatorSavedQuery$query
Return
wild

abstract protected function renderResultList($objects, $query, $handles)

This method is not documented.
Parameters
array$objects
PhabricatorSavedQuery$query
array$handles
Return
wild

public function getSearchFieldsForConduit()

This method is not documented.
Return
wild

public function buildConduitResponse($request, $method)

This method is not documented.
Parameters
ConduitAPIRequest$request
ConduitAPIMethod$method
Return
wild
This method is not documented.
Return
wild

private function getEngineExtensions()

This method is not documented.
Return
wild

private function getConduitFieldExtensions()

This method is not documented.
Return
wild

private function setQueryOrderForConduit($query, $request)

This method is not documented.
Parameters
$query
ConduitAPIRequest$request
Return
wild

private function setPagerLimitForConduit($pager, $request)

This method is not documented.
Parameters
$pager
ConduitAPIRequest$request
Return
wild

private function setPagerOffsetsForConduit($pager, $request)

This method is not documented.
Parameters
$pager
ConduitAPIRequest$request
Return
wild

protected function getObjectWireFieldsForConduit($object, $field_extensions, $extension_data)

This method is not documented.
Parameters
$object
array$field_extensions
array$extension_data
Return
wild

public function getConduitSearchAttachments()

This method is not documented.
Return
wild

final public function renderNewUserView()

This method is not documented.
Return
wild

protected function getNewUserHeader()

This method is not documented.
Return
wild

protected function getNewUserBody()

This method is not documented.
Return
wild

public function newUseResultsActions($saved)

This method is not documented.
Parameters
PhabricatorSavedQuery$saved
Return
wild

public function canExport()

This method is not documented.
Return
wild

final public function newExportFieldList()

This method is not documented.
Return
wild

final public function newExport($objects)

This method is not documented.
Parameters
array$objects
Return
wild

protected function newExportFields()

This method is not documented.
Return
wild

protected function newExportData($objects)

This method is not documented.
Parameters
array$objects
Return
wild

private function newExportExtensions()

This method is not documented.
Return
wild