jenkins-bot has submitted this change and it was merged.
Change subject: Report ES doc id in RunSearch rather than the title page id
......................................................................
Report ES doc id in RunSearch rather than the title page id
On our test instances when we import an elasticsearch dump we
typically only load ES, and not the mysql database. Due to this
all titles report an id of 0. Instead report the doc id from
elasticsearch. Within CirrusSearch the doc id of a page is always
it's page id.
Change-Id: Ia7d2b92a1720cc5fedab4ba0bc2dd9875c9aba4a
---
M includes/Search/Result.php
M maintenance/runSearch.php
2 files changed, 9 insertions(+), 1 deletion(-)
Approvals:
Smalyshev: Looks good to me, but someone else must approve
Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
DCausse: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Search/Result.php b/includes/Search/Result.php
index 04b1bdb..2cb6fd1 100644
--- a/includes/Search/Result.php
+++ b/includes/Search/Result.php
@@ -38,6 +38,7 @@
private $wordCount;
private $byteSize;
private $timestamp;
+ private $docId;
/**
* Build the result.
@@ -50,6 +51,7 @@
if ( $interwiki ) {
$this->setInterwiki( $result, $interwiki );
}
+ $this->docId = $result->getId();
$this->mTitle = Title::makeTitle( $result->namespace,
$result->title, '', $this->interwiki );
if ( $this->getTitle()->getNamespace() == NS_FILE ) {
$this->mImage = wfFindFile( $this->mTitle );
@@ -273,4 +275,8 @@
public function getInterwikiNamespaceText() {
return $this->interwikiNamespace;
}
+
+ public function getDocId() {
+ return $this->docId;
+ }
}
diff --git a/maintenance/runSearch.php b/maintenance/runSearch.php
index fe600f2..30bc4e9 100644
--- a/maintenance/runSearch.php
+++ b/maintenance/runSearch.php
@@ -109,7 +109,9 @@
$result = $value->next();
while ( $result ) {
$data['rows'][] = array(
- 'pageId' =>
$result->getTitle()->getArticleId(),
+ // use getDocId() rather than
asking the title to allow this script
+ // to work when a production
index has been imported to a test es instance
+ 'pageId' => $result->getDocId(),
'title' =>
$result->getTitle()->getPrefixedText(),
'snippets' => array(
'text' =>
$result->getTextSnippet( $query ),
--
To view, visit https://gerrit.wikimedia.org/r/251658
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7d2b92a1720cc5fedab4ba0bc2dd9875c9aba4a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: Tjones <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits