Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/query/ManiphestTaskSearchEngine.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | final class ManiphestTaskSearchEngine | ||||
} | } | ||||
protected function buildCustomSearchFields() { | protected function buildCustomSearchFields() { | ||||
// Hide the "Subtypes" constraint from the web UI if the install only | // Hide the "Subtypes" constraint from the web UI if the install only | ||||
// defines one task subtype, since it isn't of any use in this case. | // defines one task subtype, since it isn't of any use in this case. | ||||
$subtype_map = id(new ManiphestTask())->newEditEngineSubtypeMap(); | $subtype_map = id(new ManiphestTask())->newEditEngineSubtypeMap(); | ||||
$hide_subtypes = (count($subtype_map) == 1); | $hide_subtypes = (count($subtype_map) == 1); | ||||
$hide_ferret = !PhabricatorEnv::getEnvConfig('phabricator.show-prototypes'); | |||||
return array( | return array( | ||||
id(new PhabricatorOwnersSearchField()) | id(new PhabricatorOwnersSearchField()) | ||||
->setLabel(pht('Assigned To')) | ->setLabel(pht('Assigned To')) | ||||
->setKey('assignedPHIDs') | ->setKey('assignedPHIDs') | ||||
->setConduitKey('assigned') | ->setConduitKey('assigned') | ||||
->setAliases(array('assigned')) | ->setAliases(array('assigned')) | ||||
->setDescription( | ->setDescription( | ||||
pht('Search for tasks owned by a user from a list.')), | pht('Search for tasks owned by a user from a list.')), | ||||
Show All 24 Lines | return array( | ||||
->setAliases(array('subtype')) | ->setAliases(array('subtype')) | ||||
->setDescription( | ->setDescription( | ||||
pht('Search for tasks with given subtypes.')) | pht('Search for tasks with given subtypes.')) | ||||
->setDatasource(new ManiphestTaskSubtypeDatasource()) | ->setDatasource(new ManiphestTaskSubtypeDatasource()) | ||||
->setIsHidden($hide_subtypes), | ->setIsHidden($hide_subtypes), | ||||
id(new PhabricatorSearchTextField()) | id(new PhabricatorSearchTextField()) | ||||
->setLabel(pht('Contains Words')) | ->setLabel(pht('Contains Words')) | ||||
->setKey('fulltext'), | ->setKey('fulltext'), | ||||
id(new PhabricatorSearchTextField()) | |||||
->setLabel(pht('Query (Prototype)')) | |||||
->setKey('query') | |||||
->setIsHidden($hide_ferret), | |||||
id(new PhabricatorSearchThreeStateField()) | id(new PhabricatorSearchThreeStateField()) | ||||
->setLabel(pht('Open Parents')) | ->setLabel(pht('Open Parents')) | ||||
->setKey('hasParents') | ->setKey('hasParents') | ||||
->setAliases(array('blocking')) | ->setAliases(array('blocking')) | ||||
->setOptions( | ->setOptions( | ||||
pht('(Show All)'), | pht('(Show All)'), | ||||
pht('Show Only Tasks With Open Parents'), | pht('Show Only Tasks With Open Parents'), | ||||
pht('Show Only Tasks Without Open Parents')), | pht('Show Only Tasks Without Open Parents')), | ||||
Show All 39 Lines | protected function getDefaultFieldOrder() { | ||||
return array( | return array( | ||||
'assignedPHIDs', | 'assignedPHIDs', | ||||
'projectPHIDs', | 'projectPHIDs', | ||||
'authorPHIDs', | 'authorPHIDs', | ||||
'subscriberPHIDs', | 'subscriberPHIDs', | ||||
'statuses', | 'statuses', | ||||
'priorities', | 'priorities', | ||||
'subtypes', | 'subtypes', | ||||
'query', | |||||
'fulltext', | 'fulltext', | ||||
'hasParents', | 'hasParents', | ||||
'hasSubtasks', | 'hasSubtasks', | ||||
'parentIDs', | 'parentIDs', | ||||
'subtaskIDs', | 'subtaskIDs', | ||||
'group', | 'group', | ||||
'order', | 'order', | ||||
'ids', | 'ids', | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | protected function buildQueryFromParameters(array $map) { | ||||
if ($map['hasSubtasks'] !== null) { | if ($map['hasSubtasks'] !== null) { | ||||
$query->withOpenSubtasks($map['hasSubtasks']); | $query->withOpenSubtasks($map['hasSubtasks']); | ||||
} | } | ||||
if (strlen($map['fulltext'])) { | if (strlen($map['fulltext'])) { | ||||
$query->withFullTextSearch($map['fulltext']); | $query->withFullTextSearch($map['fulltext']); | ||||
} | } | ||||
if (strlen($map['query'])) { | |||||
$raw_query = $map['query']; | |||||
$compiler = id(new PhutilSearchQueryCompiler()) | |||||
->setEnableFunctions(true); | |||||
$raw_tokens = $compiler->newTokens($raw_query); | |||||
$fulltext_tokens = array(); | |||||
foreach ($raw_tokens as $raw_token) { | |||||
$fulltext_token = id(new PhabricatorFulltextToken()) | |||||
->setToken($raw_token); | |||||
$fulltext_tokens[] = $fulltext_token; | |||||
} | |||||
$query->withFerretConstraint( | |||||
id(new ManiphestTask())->newFerretEngine(), | |||||
$fulltext_tokens); | |||||
} | |||||
if ($map['parentIDs']) { | if ($map['parentIDs']) { | ||||
$query->withParentTaskIDs($map['parentIDs']); | $query->withParentTaskIDs($map['parentIDs']); | ||||
} | } | ||||
if ($map['subtaskIDs']) { | if ($map['subtaskIDs']) { | ||||
$query->withSubtaskIDs($map['subtaskIDs']); | $query->withSubtaskIDs($map['subtaskIDs']); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 209 Lines • Show Last 20 Lines |