Changeset View
Changeset View
Standalone View
Standalone View
src/applications/feed/query/PhabricatorFeedSearchEngine.php
| Show All 24 Lines | return array( | ||||
| ->setLabel(pht('Include Users')) | ->setLabel(pht('Include Users')) | ||||
| ->setKey('userPHIDs'), | ->setKey('userPHIDs'), | ||||
| // NOTE: This query is not executed with EdgeLogic, so we can't use | // NOTE: This query is not executed with EdgeLogic, so we can't use | ||||
| // a fancy logical datasource. | // a fancy logical datasource. | ||||
| id(new PhabricatorSearchDatasourceField()) | id(new PhabricatorSearchDatasourceField()) | ||||
| ->setDatasource(new PhabricatorProjectDatasource()) | ->setDatasource(new PhabricatorProjectDatasource()) | ||||
| ->setLabel(pht('Include Projects')) | ->setLabel(pht('Include Projects')) | ||||
| ->setKey('projectPHIDs'), | ->setKey('projectPHIDs'), | ||||
| id(new PhabricatorSearchDateControlField()) | |||||
| ->setLabel(pht('Occurs After')) | |||||
| ->setKey('rangeStart'), | |||||
| id(new PhabricatorSearchDateControlField()) | |||||
| ->setLabel(pht('Occurs Before')) | |||||
| ->setKey('rangeEnd'), | |||||
| // NOTE: This is a legacy field retained only for backward | // NOTE: This is a legacy field retained only for backward | ||||
| // compatibility. If the projects field used EdgeLogic, we could use | // compatibility. If the projects field used EdgeLogic, we could use | ||||
| // `viewerprojects()` to execute an equivalent query. | // `viewerprojects()` to execute an equivalent query. | ||||
| id(new PhabricatorSearchCheckboxesField()) | id(new PhabricatorSearchCheckboxesField()) | ||||
| ->setKey('viewerProjects') | ->setKey('viewerProjects') | ||||
| ->setOptions( | ->setOptions( | ||||
| array( | array( | ||||
| Show All 25 Lines | if ($viewer_projects) { | ||||
| ->execute(); | ->execute(); | ||||
| $phids += array_fuse(mpull($projects, 'getPHID')); | $phids += array_fuse(mpull($projects, 'getPHID')); | ||||
| } | } | ||||
| if ($phids) { | if ($phids) { | ||||
| $query->withFilterPHIDs($phids); | $query->withFilterPHIDs($phids); | ||||
| } | } | ||||
| $range_min = $map['rangeStart']; | |||||
| if ($range_min) { | |||||
| $range_min = $range_min->getEpoch(); | |||||
| } | |||||
| $range_max = $map['rangeEnd']; | |||||
| if ($range_max) { | |||||
| $range_max = $range_max->getEpoch(); | |||||
| } | |||||
| if ($range_min && $range_max) { | |||||
| if ($range_min > $range_max) { | |||||
| throw new PhabricatorSearchConstraintException( | |||||
| pht( | |||||
| 'The specified "Occurs Before" date is earlier in time than the '. | |||||
| 'specified "Occurs After" date, so this query can never match '. | |||||
| 'any results.')); | |||||
| } | |||||
| } | |||||
| if ($range_min || $range_max) { | |||||
| $query->withEpochInRange($range_min, $range_max); | |||||
| } | |||||
| return $query; | return $query; | ||||
| } | } | ||||
| protected function getURI($path) { | protected function getURI($path) { | ||||
| return '/feed/'.$path; | return '/feed/'.$path; | ||||
| } | } | ||||
| protected function getBuiltinQueryNames() { | protected function getBuiltinQueryNames() { | ||||
| ▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines | |||||