Don't lose namespace when searching via api
authorErik Bernhardson <ebernhardson@wikimedia.org>
Thu, 2 Jun 2016 20:12:16 +0000 (13:12 -0700)
committerErik Bernhardson <ebernhardson@wikimedia.org>
Thu, 2 Jun 2016 20:12:20 +0000 (13:12 -0700)
A recent patch, I66be724d, introduced a regression that no longer
applied user selected namespaces to the search engine. Fix that up so we
give the correct responses to api rqeuests.

Change-Id: I8e5e180cb143ae3cddeb12f51bc7aae75b20fe58

includes/api/SearchApi.php

index 26d7a0e..139793d 100644 (file)
@@ -86,7 +86,7 @@ trait SearchApi {
                        $type = isset( $params['backend'] ) ? $params['backend'] : null;
                        $searchEngine = MediaWikiServices::getInstance()->getSearchEngineFactory()->create( $type );
                        $limit = $params['limit'];
-                       $namespaces = $params['namespace'];
+                       $searchEngine->setNamespaces( $params['namespace'] );
                        $offset = null;
                        if ( isset( $params['offset'] ) ) {
                                // If the API supports offset then it probably