Page MenuHomePhabricator

D8121.id18405.diff
No OneTemporary

D8121.id18405.diff

Index: src/applications/search/controller/PhabricatorApplicationSearchController.php
===================================================================
--- src/applications/search/controller/PhabricatorApplicationSearchController.php
+++ 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);
Index: src/applications/search/engine/PhabricatorApplicationSearchEngine.php
===================================================================
--- src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ 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.
*/
Index: src/applications/search/index/PhabricatorSearchIndexer.php
===================================================================
--- src/applications/search/index/PhabricatorSearchIndexer.php
+++ 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)) {
Index: src/view/control/AphrontPagerView.php
===================================================================
--- src/view/control/AphrontPagerView.php
+++ 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

Mime Type
text/plain
Expires
Fri, Sep 20, 7:42 AM (12 h, 31 s)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6622888
Default Alt Text
D8121.id18405.diff (3 KB)

Event Timeline