From c24303d6b01352f8b43a2b8bbb844dad6bdf16d4 Mon Sep 17 00:00:00 2001 From: Erik Bernhardson Date: Mon, 18 May 2015 16:19:12 -0700 Subject: [PATCH] Search: Allow searchContainedSyntax to be defined by constructor The SearchResultSet is returned where no query is performed because it is known ahead of time that no result exists. In cases where that is known due to the syntax of the query (e.g. the syntax requires searching a category that does not exist) this searchContainedSyntax method returns the wrong value. This patch makes it possible for the instantiating code to properly set the return value of this method. Change-Id: I7b7be24f5630a48d2a561e4fda9cec696a8cacf9 --- includes/search/SearchResultSet.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/search/SearchResultSet.php b/includes/search/SearchResultSet.php index 406d322d6f..0a05eef159 100644 --- a/includes/search/SearchResultSet.php +++ b/includes/search/SearchResultSet.php @@ -25,6 +25,12 @@ * @ingroup Search */ class SearchResultSet { + protected $containedSyntax = false; + + public function __construct( $containedSyntax = false ) { + $this->containedSyntax = $containedSyntax; + } + /** * Fetch an array of regular expression fragments for matching * the search terms as parsed by this engine in a text extract. @@ -120,7 +126,7 @@ class SearchResultSet { * @return bool */ public function searchContainedSyntax() { - return false; + return $this->containedSyntax; } } -- 2.20.1