r55392 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55391‎ | r55392 | r55393 >
Date:20:29, 20 August 2009
Author:rainman
Status:deferred (Comments)
Tags:
Comment:
Propagate search method to LuceneResult so we can supress revision loading when its not needed
Modified paths:
  • /trunk/extensions/MWSearch/MWSearch_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MWSearch/MWSearch_body.php
@@ -157,10 +157,11 @@
158158 * Construct a result object from single result line
159159 *
160160 * @param array $lines
 161+ * @param string $method - method used to fetch these results
161162 * @return array (float, Title)
162163 * @access private
163164 */
164 - function LuceneResult( $lines ) {
 165+ function LuceneResult( $lines, $method ) {
165166 global $wgContLang;
166167
167168 $score = null;
@@ -244,7 +245,8 @@
245246 $this->mSectionTitle = Title::newFromText($t);
246247 }
247248
248 - if($this->mInterwiki == '')
 249+ # fetch revision info if not an interwiki title, and not using prefix search
 250+ if($this->mInterwiki == '' && $method != 'prefix')
249251 $this->mRevision = Revision::newFromTitle( $this->mTitle );
250252
251253 if(!is_null($this->mTitle) && $this->mTitle->getNamespace() == NS_IMAGE)
@@ -527,7 +529,7 @@
528530 while(!self::startsWith($resultLines[$interwikiLen],"#results"))
529531 $interwikiLen++;
530532 $interwikiLines = array_splice($resultLines,0,$interwikiLen);
531 - $interwiki = new LuceneSearchSet( $query, $interwikiLines, intval($iwCount), intval($iwTotal) );
 533+ $interwiki = new LuceneSearchSet( $method, $query, $interwikiLines, intval($iwCount), intval($iwTotal) );
532534 }
533535
534536 # how many results we got
@@ -539,7 +541,7 @@
540542 }
541543
542544
543 - $resultSet = new LuceneSearchSet( $query, $resultLines, $resultCount, $totalHits,
 545+ $resultSet = new LuceneSearchSet( $method, $query, $resultLines, $resultCount, $totalHits,
544546 $suggestion, $info, $interwiki );
545547
546548 if($wgLuceneSearchCacheExpiry > 0){
@@ -557,7 +559,8 @@
558560
559561 /**
560562 * Private constructor. Use LuceneSearchSet::newFromQuery().
561 - *
 563+ *
 564+ * @param string $method
562565 * @param string $query
563566 * @param array $lines
564567 * @param int $resultCount
@@ -566,7 +569,8 @@
567570 * @param string $info
568571 * @access private
569572 */
570 - function LuceneSearchSet( $query, $lines, $resultCount, $totalHits = null, $suggestion = null, $info = null, $interwiki = null ) {
 573+ function LuceneSearchSet( $method, $query, $lines, $resultCount, $totalHits = null, $suggestion = null, $info = null, $interwiki = null ) {
 574+ $this->mMethod = $method;
571575 $this->mQuery = $query;
572576 $this->mTotalHits = $totalHits;
573577 $this->mResults = $lines;
@@ -740,7 +744,7 @@
741745 if($group == false)
742746 return false;
743747 else
744 - return new LuceneResult( $group );
 748+ return new LuceneResult( $group, $this->mMethod );
745749 }
746750
747751 }

Comments

#Comment by Raymond (talk | contribs)   12:38, 8 September 2009

Deployed per r56024 by Domas.

Status & tagging log