Demon has uploaded a new change for review.
https://gerrit.wikimedia.org/r/69506
Change subject: Pass content to SearchUpdate rather than raw text
......................................................................
Pass content to SearchUpdate rather than raw text
This is still less than ideal, but at least consolidates the
logic so we can later implement more content-specific handling.
Change-Id: Ic24a7ea2818f6eeb67453877dc5a31f110541ecf
---
M includes/WikiPage.php
M includes/search/SearchUpdate.php
M maintenance/Maintenance.php
M maintenance/rebuildtextindex.php
4 files changed, 5 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/06/69506/1
diff --git a/includes/WikiPage.php b/includes/WikiPage.php
index 9e6a0c8..0cf7f33 100644
--- a/includes/WikiPage.php
+++ b/includes/WikiPage.php
@@ -2109,7 +2109,7 @@
}
DeferredUpdates::addUpdate( new SiteStatsUpdate( 0, 1, $good,
$total ) );
- DeferredUpdates::addUpdate( new SearchUpdate( $id, $title,
$content->getTextForSearchIndex() ) );
+ DeferredUpdates::addUpdate( new SearchUpdate( $id, $title,
$content ) );
// @todo let the search engine decide what to do with the
content object
// If this is another user's talk page, update newtalk.
diff --git a/includes/search/SearchUpdate.php b/includes/search/SearchUpdate.php
index 759c7b9..4524068 100644
--- a/includes/search/SearchUpdate.php
+++ b/includes/search/SearchUpdate.php
@@ -33,7 +33,7 @@
private $mId = 0, $mNamespace, $mTitle, $mText;
private $mTitleWords;
- public function __construct( $id, $title, $text = false ) {
+ public function __construct( $id, $title, $content = false ) {
if ( is_string( $title ) ) {
$nt = Title::newFromText( $title );
} else {
@@ -42,7 +42,7 @@
if ( $nt ) {
$this->mId = $id;
- $this->mText = $text;
+ $this->mText = $content->getTextForSearchIndex();
$this->mNamespace = $nt->getNamespace();
$this->mTitle = $nt->getText(); # Discard namespace
diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php
index a2bbec5..e29ffd9 100644
--- a/maintenance/Maintenance.php
+++ b/maintenance/Maintenance.php
@@ -1155,8 +1155,7 @@
$title = $titleObj->getPrefixedDBkey();
$this->output( "$title..." );
# Update searchindex
- # TODO: pass the Content object to SearchUpdate, let
the search engine decide how to deal with it.
- $u = new SearchUpdate( $pageId, $titleObj->getText(),
$rev->getContent()->getTextForSearchIndex() );
+ $u = new SearchUpdate( $pageId, $titleObj->getText(),
$rev->getContent() );
$u->doUpdate();
$this->output( "\n" );
}
diff --git a/maintenance/rebuildtextindex.php b/maintenance/rebuildtextindex.php
index a31aba2..c651f72 100644
--- a/maintenance/rebuildtextindex.php
+++ b/maintenance/rebuildtextindex.php
@@ -115,9 +115,8 @@
$rev = new Revision( $s );
$content = $rev->getContent();
- $text =
$content->getTextForSearchIndex();
- $u = new SearchUpdate( $s->page_id,
$title, $text );
+ $u = new SearchUpdate( $s->page_id,
$title, $content );
$u->doUpdate();
} catch ( MWContentSerializationException $ex )
{
$this->output( "Failed to deserialize
content of revision {$s->rev_id} of page "
--
To view, visit https://gerrit.wikimedia.org/r/69506
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic24a7ea2818f6eeb67453877dc5a31f110541ecf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Demon <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits