Index: trunk/extensions/MWSearch/MWSearch_body.php |
— | — | @@ -157,10 +157,11 @@ |
158 | 158 | * Construct a result object from single result line |
159 | 159 | * |
160 | 160 | * @param array $lines |
| 161 | + * @param string $method - method used to fetch these results |
161 | 162 | * @return array (float, Title) |
162 | 163 | * @access private |
163 | 164 | */ |
164 | | - function LuceneResult( $lines ) { |
| 165 | + function LuceneResult( $lines, $method ) { |
165 | 166 | global $wgContLang; |
166 | 167 | |
167 | 168 | $score = null; |
— | — | @@ -244,7 +245,8 @@ |
245 | 246 | $this->mSectionTitle = Title::newFromText($t); |
246 | 247 | } |
247 | 248 | |
248 | | - if($this->mInterwiki == '') |
| 249 | + # fetch revision info if not an interwiki title, and not using prefix search |
| 250 | + if($this->mInterwiki == '' && $method != 'prefix') |
249 | 251 | $this->mRevision = Revision::newFromTitle( $this->mTitle ); |
250 | 252 | |
251 | 253 | if(!is_null($this->mTitle) && $this->mTitle->getNamespace() == NS_IMAGE) |
— | — | @@ -527,7 +529,7 @@ |
528 | 530 | while(!self::startsWith($resultLines[$interwikiLen],"#results")) |
529 | 531 | $interwikiLen++; |
530 | 532 | $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) ); |
532 | 534 | } |
533 | 535 | |
534 | 536 | # how many results we got |
— | — | @@ -539,7 +541,7 @@ |
540 | 542 | } |
541 | 543 | |
542 | 544 | |
543 | | - $resultSet = new LuceneSearchSet( $query, $resultLines, $resultCount, $totalHits, |
| 545 | + $resultSet = new LuceneSearchSet( $method, $query, $resultLines, $resultCount, $totalHits, |
544 | 546 | $suggestion, $info, $interwiki ); |
545 | 547 | |
546 | 548 | if($wgLuceneSearchCacheExpiry > 0){ |
— | — | @@ -557,7 +559,8 @@ |
558 | 560 | |
559 | 561 | /** |
560 | 562 | * Private constructor. Use LuceneSearchSet::newFromQuery(). |
561 | | - * |
| 563 | + * |
| 564 | + * @param string $method |
562 | 565 | * @param string $query |
563 | 566 | * @param array $lines |
564 | 567 | * @param int $resultCount |
— | — | @@ -566,7 +569,8 @@ |
567 | 570 | * @param string $info |
568 | 571 | * @access private |
569 | 572 | */ |
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; |
571 | 575 | $this->mQuery = $query; |
572 | 576 | $this->mTotalHits = $totalHits; |
573 | 577 | $this->mResults = $lines; |
— | — | @@ -740,7 +744,7 @@ |
741 | 745 | if($group == false) |
742 | 746 | return false; |
743 | 747 | else |
744 | | - return new LuceneResult( $group ); |
| 748 | + return new LuceneResult( $group, $this->mMethod ); |
745 | 749 | } |
746 | 750 | |
747 | 751 | } |