Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15477170
D8121.id18369.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8121.id18369.diff
View Options
diff --git a/src/applications/search/controller/PhabricatorApplicationSearchController.php b/src/applications/search/controller/PhabricatorApplicationSearchController.php
--- a/src/applications/search/controller/PhabricatorApplicationSearchController.php
+++ b/src/applications/search/controller/PhabricatorApplicationSearchController.php
@@ -7,6 +7,16 @@
private $navigation;
private $queryKey;
private $preface;
+ private $useOffsetPaging;
+
+ public function setUseOffsetPaging($use_offset_paging) {
+ $this->useOffsetPaging = $use_offset_paging;
+ return $this;
+ }
+
+ public function getUseOffsetPaging() {
+ return $this->useOffsetPaging;
+ }
public function setPreface($preface) {
$this->preface = $preface;
@@ -213,7 +223,12 @@
$query = $engine->buildQueryFromSavedQuery($saved_query);
- $pager = new AphrontCursorPagerView();
+ $use_offset_paging = $this->getUseOffsetPaging();
+ if ($use_offset_paging) {
+ $pager = new AphrontPagerView();
+ } else {
+ $pager = new AphrontCursorPagerView();
+ }
$pager->readFromRequest($request);
$page_size = $engine->getPageSize($saved_query);
if (is_finite($page_size)) {
@@ -225,8 +240,14 @@
// with INF seems to vary across PHP versions, systems, and runtimes.
$pager->setPageSize(0xFFFF);
}
- $objects = $query->setViewer($request->getUser())
- ->executeWithCursorPager($pager);
+
+ $query->setViewer($request->getUser());
+
+ if ($use_offset_paging) {
+ $objects = $query->executeWithOffsetPager($pager);
+ } else {
+ $objects = $query->executeWithCursorPager($pager);
+ }
$list = $parent->renderResultsList($objects, $saved_query);
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -349,7 +349,7 @@
* This provides flexibility when constructing URIs, especially from external
* sources.
*
- * @param AphrontRequest Request to read PHIDs from.
+ * @param AphrontRequest Request to read strings from.
* @param string Key to read in the request.
* @return list<string> List of values.
*/
diff --git a/src/applications/search/index/PhabricatorSearchIndexer.php b/src/applications/search/index/PhabricatorSearchIndexer.php
--- a/src/applications/search/index/PhabricatorSearchIndexer.php
+++ b/src/applications/search/index/PhabricatorSearchIndexer.php
@@ -11,16 +11,9 @@
}
public function indexDocumentByPHID($phid) {
- $doc_indexer_symbols = id(new PhutilSymbolLoader())
+ $indexers = id(new PhutilSymbolLoader())
->setAncestorClass('PhabricatorSearchDocumentIndexer')
- ->setConcreteOnly(true)
- ->setType('class')
- ->selectAndLoadSymbols();
-
- $indexers = array();
- foreach ($doc_indexer_symbols as $symbol) {
- $indexers[] = newv($symbol['name'], array());
- }
+ ->loadObjects();
foreach ($indexers as $indexer) {
if ($indexer->shouldIndexDocumentByPHID($phid)) {
diff --git a/src/view/control/AphrontPagerView.php b/src/view/control/AphrontPagerView.php
--- a/src/view/control/AphrontPagerView.php
+++ b/src/view/control/AphrontPagerView.php
@@ -47,6 +47,17 @@
return $this;
}
+ final public function readFromRequest(AphrontRequest $request) {
+ $this->uri = $request->getRequestURI();
+ $this->pagingParameter = 'offset';
+ $this->offset = $request->getInt($this->pagingParameter);
+ return $this;
+ }
+
+ final public function willShowPagingControls() {
+ return $this->hasMorePages;
+ }
+
final public function setSurroundingPages($pages) {
$this->surroundingPages = max(0, $pages);
return $this;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 8, 12:50 PM (18 h, 13 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7729457
Default Alt Text
D8121.id18369.diff (3 KB)
Attached To
Mode
D8121: Allow ApplicationSearch to be offset-paged
Attached
Detach File
Event Timeline
Log In to Comment