EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/295310

Change subject: Adjust Searcher maximum result depth
......................................................................

Adjust Searcher maximum result depth

Since upgrading to elasticsearch 2.x we have been getting new errors in
cirrus logs about searching too deep into the index. The default in
elasticsearch is 10,000 items. This seems like more than enough, so
adjust our own limit of 100,000 to match the 10,000 set in
elasticsearch.

Bug: T136937
Change-Id: I03bf300aec3a733f56c62ae0e626cd51f6470f33
---
M includes/Searcher.php
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/10/295310/1

diff --git a/includes/Searcher.php b/includes/Searcher.php
index 52926d4..5238cbc 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -63,10 +63,11 @@
        const MAX_TEXT_SEARCH = 300;
 
        /**
-        * Maximum offset depth allowed.  Too deep will cause very slow queries.
-        * 100,000 feels plenty deep.
+        * Maximum offset + limit depth allowed. As in the deepest possible 
result 
+        * to return. Too deep will cause very slow queries. 10,000 feels plenty
+        * deep. This should be <= index.max_result_window in elasticsearch.
         */
-       const MAX_OFFSET = 100000;
+       const MAX_OFFSET_LIMIT = 10000;
 
        /**
         * @var integer search offset
@@ -218,8 +219,8 @@
 
                parent::__construct( $conn, $user, $config->get( 
'CirrusSearchSlowSearch' ) );
                $this->config = $config;
-               $this->offset = min( $offset, self::MAX_OFFSET );
-               $this->limit = $limit;
+               $this->limit = min( $limit, self::MAX_OFFSET_LIMIT );
+               $this->offset = min( $offset, self::MAX_OFFSET_LIMIT - 
$this->limit );
                $this->indexBaseName = $index ?: $config->getWikiId();
                $this->language = $config->get( 'ContLang' );
                $this->escaper = new Escaper( $config->get( 'LanguageCode' ), 
$config->get( 'CirrusSearchAllowLeadingWildcard' ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/295310
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03bf300aec3a733f56c62ae0e626cd51f6470f33
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to