jenkins-bot has submitted this change and it was merged. Change subject: Save links to the search index ......................................................................
Save links to the search index We can count these links during page updates to find page weights. Bug: 56798 Note that this doesn't solve the bug - we still have to deploy this change, rebuild all the indexes, and then deploy the counting solution. Change-Id: Idd10a413fedfbfeed55d013faf6706329e0bec02 --- M includes/CirrusSearchMappingConfigBuilder.php M includes/CirrusSearchUpdater.php 2 files changed, 19 insertions(+), 4 deletions(-) Approvals: Chad: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/CirrusSearchMappingConfigBuilder.php b/includes/CirrusSearchMappingConfigBuilder.php index 69146b6..fb97ab9 100644 --- a/includes/CirrusSearchMappingConfigBuilder.php +++ b/includes/CirrusSearchMappingConfigBuilder.php @@ -57,6 +57,7 @@ 'title' => $this->buildStringField( 'title', $titleExtraAnalyzers ), 'text' => $this->buildStringField( 'text', $textExtraAnalyzers ), 'category' => $this->buildLowercaseKeywordField(), + 'outgoing_link' => $this->buildLowercaseKeywordField(), 'heading' => $this->buildStringField( 'heading' ), 'text_bytes' => $this->buildLongField(), 'text_words' => $this->buildLongField(), @@ -66,8 +67,10 @@ 'title' => $this->buildStringField( 'title', array( 'suggest' ) ), ) ), - 'links' => $this->buildLongField(), - 'redirect_links' => $this->buildLongField(), + 'links' => $this->buildLongField(), #Deprecated + 'redirect_links' => $this->buildLongField(), #Deprecated + 'incoming_links' => $this->buildLongField(), + 'incoming_redirect_links' => $this->buildLongField(), ), ); } diff --git a/includes/CirrusSearchUpdater.php b/includes/CirrusSearchUpdater.php index 73e7f5b..e5d7a26 100644 --- a/includes/CirrusSearchUpdater.php +++ b/includes/CirrusSearchUpdater.php @@ -278,9 +278,20 @@ } } $doc->add( 'heading', $headings ); + + $outgoingLinks = array(); + foreach ( $parserOutput->getLinks() as $linkedNamespace => $namespaceLinks ) { + foreach ( $namespaceLinks as $linkedDbKey => $ignored ) { + $linked = Title::makeTitle( $linkedNamespace, $linkedDbKey ); + $outgoingLinks[] = $linked->getPrefixedDBKey(); + } + } + $doc->add( 'outgoing_link', $outgoingLinks ); } - $doc->add( 'links', self::countLinksToTitle( $title ) ); + $incomingLinks = self::countLinksToTitle( $title ); + $doc->add( 'links', $incomingLinks ); #Deprecated + $doc->add( 'incoming_links', $incomingLinks ); // Handle redirects to this page $redirectTitles = $title->getLinksTo( array( 'limit' => $wgCirrusSearchIndexedRedirects ), 'redirect', 'rd' ); @@ -299,7 +310,8 @@ $redirectLinks += self::countLinksToTitle( $redirect ); } $doc->add( 'redirect', $redirects ); - $doc->add( 'redirect_links', $redirectLinks ); + $doc->add( 'redirect_links', $redirectLinks ); #Deprecated + $doc->add( 'incoming_redirect_links', $redirectLinks ); wfProfileOut( __METHOD__ ); return $doc; -- To view, visit https://gerrit.wikimedia.org/r/94967 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idd10a413fedfbfeed55d013faf6706329e0bec02 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits