Increase parity between api search and on-wiki search
[lhc/web/wiklou.git] / includes / api / ApiQuerySearch.php
index e29ef8d..c12630e 100644 (file)
@@ -129,6 +129,8 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                        if ( isset( $searchInfo['suggestion'] ) && $matches->hasSuggestion() ) {
                                $apiResult->addValue( array( 'query', 'searchinfo' ),
                                        'suggestion', $matches->getSuggestionQuery() );
+                               $apiResult->addValue( array( 'query', 'searchinfo' ),
+                                       'suggestionsnippet', $matches->getSuggestionSnippet() );
                        }
                }
 
@@ -172,6 +174,9 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                                if ( isset( $prop['titlesnippet'] ) ) {
                                        $vals['titlesnippet'] = $result->getTitleSnippet();
                                }
+                               if ( isset( $prop['categorysnippet'] ) ) {
+                                       $vals['categorysnippet'] = $result->getCategorySnippet();
+                               }
                                if ( !is_null( $result->getRedirectTitle() ) ) {
                                        if ( isset( $prop['redirecttitle'] ) ) {
                                                $vals['redirecttitle'] = $result->getRedirectTitle()->getPrefixedText();
@@ -188,6 +193,9 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                                                $vals['sectionsnippet'] = $result->getSectionSnippet();
                                        }
                                }
+                               if ( isset( $prop['isfilematch'] ) ) {
+                                       $vals['isfilematch'] = $result->isFileMatch();
+                               }
 
                                // Add item to results and see whether it fits
                                $fit = $apiResult->addValue( array( 'query', $this->getModuleName() ),
@@ -314,6 +322,8 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                                        'sectiontitle',
                                        'sectionsnippet',
                                        'hasrelated',
+                                       'isfilematch',
+                                       'categorysnippet',
                                ),
                                ApiBase::PARAM_ISMULTI => true,
                        ),