From d5fc4b8655a105a27adc9e25f0408c7fbfff76c8 Mon Sep 17 00:00:00 2001 From: Yaron Koren Date: Thu, 3 May 2018 17:41:30 +0000 Subject: [PATCH] Added limit for search query Change-Id: I62cd622cfd2f9d44f09648ec51932acdb54a3991 (cherry picked from commit c854531150af065fd4ee9b4e77b6edf27cf8de16) --- src/ReplaceTextSearch.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ReplaceTextSearch.php b/src/ReplaceTextSearch.php index c59bdd54..b57c677c 100644 --- a/src/ReplaceTextSearch.php +++ b/src/ReplaceTextSearch.php @@ -35,9 +35,14 @@ class ReplaceTextSearch { self::categoryCondition( $category, $tables, $conds ); self::prefixCondition( $prefix, $conds ); - $sort = [ 'ORDER BY' => 'page_namespace, page_title' ]; + $options = [ + 'ORDER BY' => 'page_namespace, page_title', + // 250 seems like a reasonable limit for one screen. + // @TODO - should probably be a setting. + 'LIMIT' => 250 + ]; - return $dbr->select( $tables, $vars, $conds, __METHOD__, $sort ); + return $dbr->select( $tables, $vars, $conds, __METHOD__, $options ); } /**