Manybubbles has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/208267

Change subject: Add categorysnippet to ApiQuerySearch
......................................................................

Add categorysnippet to ApiQuerySearch

No reason not to expose it - its already part of the search results and
its simple to return.

One fun wrinkle is that categorysnippet isn't returned if redirectsnippet
is because that is what is required by the html ui.

Change-Id: I256fc8f9072e28cbdfdf01321270a2ab3b42c731
---
M includes/api/ApiQuerySearch.php
1 file changed, 4 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/67/208267/1

diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index e29ef8d..5e000a8 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -180,12 +180,9 @@
                                                $vals['redirectsnippet'] = 
$result->getRedirectSnippet();
                                        }
                                }
-                               if ( !is_null( $result->getSectionTitle() ) ) {
-                                       if ( isset( $prop['sectiontitle'] ) ) {
-                                               $vals['sectiontitle'] = 
$result->getSectionTitle()->getFragment();
-                                       }
-                                       if ( isset( $prop['sectionsnippet'] ) ) 
{
-                                               $vals['sectionsnippet'] = 
$result->getSectionSnippet();
+                               if ( isset( $prop['categorysnippet'] ) ) {
+                                       if ( $result->getCategorySnippet() ) {
+                                               $vals['categorysnippet'] = 
$result->getCategorySnippet();
                                        }
                                }
 
@@ -314,6 +311,7 @@
                                        'sectiontitle',
                                        'sectionsnippet',
                                        'hasrelated',
+                                       'categorysnippet',
                                ),
                                ApiBase::PARAM_ISMULTI => true,
                        ),

-- 
To view, visit https://gerrit.wikimedia.org/r/208267
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I256fc8f9072e28cbdfdf01321270a2ab3b42c731
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <never...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to