Manybubbles has uploaded a new change for review.

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


Change subject: Merge redirect updates with title updates.
......................................................................

Merge redirect updates with title updates.

Now that we have lots of different ways that we can trigger a search
update using a Title object we should merge as many of them together as
we can.  This merges redirect updates.

Change-Id: Iac00a7c3f9c53e38e828db49cc8c93fe43284a6f
---
M CirrusSearch.body.php
1 file changed, 5 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/26/81126/1

diff --git a/CirrusSearch.body.php b/CirrusSearch.body.php
index 110153c..346392c 100644
--- a/CirrusSearch.body.php
+++ b/CirrusSearch.body.php
@@ -419,13 +419,7 @@
                if ( $content->isRedirect() ) {
                        $target = $content->getUltimateRedirectTarget();
                        wfDebugLog( 'CirrusSearch', "Updating search index for 
$title which is a redirect to " . $target->getText() );
-                       $targetRevision = Revision::loadFromPageId( wfGetDB( 
DB_SLAVE ), $target->getArticleID() );
-                       // If you are building a redirect to a non-existant 
page then don't error out
-                       if ( $targetRevision === null ) {
-                               return;
-                       }
-                       $newUpdate = new SearchUpdate( $target->getArticleID(), 
$target, $targetRevision->getContent() );
-                       $newUpdate->doUpdate();
+                       self::updateFromTitle( $target );
                } else {
                        // Technically this is supposed to be just a title 
update but that is more complicated then
                        // just rebuilding the text.  It doesn't look like 
these title updates are used frequently
@@ -503,6 +497,10 @@
                if ( !$revision ) {
                        $revision = Revision::loadFromPageId( wfGetDB( 
DB_MASTER ), $articleId );
                }
+               // This usually happens when building a redirect to a 
non-existant page
+               if ( !$revision ) {
+                       return;
+               }
 
                $update = new SearchUpdate( $articleId, $title, 
$revision->getContent() );
                $update->doUpdate();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac00a7c3f9c53e38e828db49cc8c93fe43284a6f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to