Merge "UsersMultiselect widget and form field."
[lhc/web/wiklou.git] / includes / api / ApiOpenSearch.php
index b13ba58..e6fe27c 100644 (file)
@@ -294,7 +294,7 @@ class ApiOpenSearch extends ApiBase {
 
        public function getSearchProfileParams() {
                return [
-                       'qiprofile' => [
+                       'profile' => [
                                'profile-type' => SearchEngine::COMPLETION_PROFILE_TYPE,
                                'help-message' => 'apihelp-query+prefixsearch-param-profile'
                        ],
@@ -391,14 +391,14 @@ class ApiOpenSearchFormatJson extends ApiFormatJson {
        }
 
        public function execute() {
-               if ( !$this->getResult()->getResultData( 'error' ) ) {
-                       $result = $this->getResult();
-
+               $result = $this->getResult();
+               if ( !$result->getResultData( 'error' ) && !$result->getResultData( 'errors' ) ) {
                        // Ignore warnings or treat as errors, as requested
                        $warnings = $result->removeValue( 'warnings', null );
                        if ( $this->warningsAsError && $warnings ) {
-                               $this->dieUsage(
-                                       'Warnings cannot be represented in OpenSearch JSON format', 'warnings', 0,
+                               $this->dieWithError(
+                                       'apierror-opensearch-json-warnings',
+                                       'warnings',
                                        [ 'warnings' => $warnings ]
                                );
                        }