jenkins-bot has submitted this change and it was merged.

Change subject: Add the full page title and the article id to search results
......................................................................


Add the full page title and the article id to search results

Bug: T85368
Change-Id: If152600d0e7f6a1e15a804d40d49f876dbbe89ce
---
M repo/includes/api/SearchEntities.php
M repo/tests/phpunit/includes/api/SearchEntitiesTest.php
2 files changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Bene: Looks good to me, but someone else must approve
  Jonas Kress (WMDE): Looks good to me, but someone else must approve
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/api/SearchEntities.php 
b/repo/includes/api/SearchEntities.php
index 1236f72..9f5236c 100644
--- a/repo/includes/api/SearchEntities.php
+++ b/repo/includes/api/SearchEntities.php
@@ -176,6 +176,8 @@
                        $entry = array();
                        $entry['id'] = 
$match->getEntityId()->getSerialization();
                        $entry['url'] = $title->getFullUrl();
+                       $entry['title'] = $title->getPrefixedText();
+                       $entry['pageid'] = $title->getArticleID();
                        $displayLabel = $match->getDisplayLabel();
                        if ( !is_null( $displayLabel ) ) {
                                $entry['label'] = $displayLabel->getText();
diff --git a/repo/tests/phpunit/includes/api/SearchEntitiesTest.php 
b/repo/tests/phpunit/includes/api/SearchEntitiesTest.php
index 84a1497..27e8230 100644
--- a/repo/tests/phpunit/includes/api/SearchEntitiesTest.php
+++ b/repo/tests/phpunit/includes/api/SearchEntitiesTest.php
@@ -82,6 +82,12 @@
                $mock->expects( $this->any() )
                        ->method( 'getFullUrl' )
                        ->will( $this->returnValue( 'http://fullTitleUrl' ) );
+               $mock->expects( $this->any() )
+                       ->method( 'getPrefixedText' )
+                       ->will( $this->returnValue( 'Prefixed:Title' ) );
+               $mock->expects( $this->any() )
+                       ->method( 'getArticleID' )
+                       ->will( $this->returnValue( 42 ) );
                return $mock;
        }
 
@@ -225,6 +231,8 @@
                $q222Result = array(
                        'id' => 'Q222',
                        'url' => 'http://fullTitleUrl',
+                       'title' => 'Prefixed:Title',
+                       'pageid' => 42,
                        'label' => 'FooHeHe',
                        'description' => 'FooHeHe en description',
                        'aliases' => array( 'Fooooo' ),
@@ -237,6 +245,8 @@
                $q333Result = array(
                        'id' => 'Q333',
                        'url' => 'http://fullTitleUrl',
+                       'title' => 'Prefixed:Title',
+                       'pageid' => 42,
                        'label' => 'ADisplayLabel',
                        'aliases' => array( 'AMatchedTerm' ),
                        'match' => array(
@@ -258,6 +268,8 @@
                                        array(
                                                'id' => 'Q111',
                                                'url' => 'http://fullTitleUrl',
+                                               'title' => 'Prefixed:Title',
+                                               'pageid' => 42,
                                                'label' => 'ptLabel',
                                                'description' => 
'ptDescription',
                                                'aliases' => array( 'Q111' ),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If152600d0e7f6a1e15a804d40d49f876dbbe89ce
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene <benestar.wikime...@gmail.com>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Bene <benestar.wikime...@gmail.com>
Gerrit-Reviewer: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to