Index: trunk/extensions/LuceneSearch.php |
— | — | @@ -111,6 +111,7 @@ |
112 | 112 | $fname = 'LuceneSearch::execute'; |
113 | 113 | wfProfileIn( $fname ); |
114 | 114 | $this->setHeaders(); |
| 115 | +$wgOut->addHTML("<!-- titlens = ". $wgTitle->getNamespace() . "-->"); |
115 | 116 | |
116 | 117 | foreach(SearchEngine::searchableNamespaces() as $ns => $name) |
117 | 118 | if ($wgRequest->getCheck("ns" . $ns)) |
— | — | @@ -281,6 +282,7 @@ |
282 | 283 | $wgOut->addHTML($this->showFullDialog($q)); |
283 | 284 | } |
284 | 285 | $wgOut->setRobotpolicy('noindex,nofollow'); |
| 286 | + $wgOut->setArticleRelated(false); |
285 | 287 | wfProfileOut( $fname ); |
286 | 288 | } |
287 | 289 | |
— | — | @@ -324,7 +326,7 @@ |
325 | 327 | function showHit($result, $terms) { |
326 | 328 | $fname = 'LuceneSearch::showHit'; |
327 | 329 | wfProfileIn($fname); |
328 | | - global $wgUser, $wgContLang, $wgLSuseold; |
| 330 | + global $wgUser, $wgContLang, $wgLSuseold, $wgTitle, $wgOut; |
329 | 331 | |
330 | 332 | $t = $result->getTitle(); |
331 | 333 | if(is_null($t)) { |
— | — | @@ -341,8 +343,10 @@ |
342 | 344 | $link = $this->mSkin->makeKnownLinkObj($t, ''); |
343 | 345 | |
344 | 346 | $rev = $wgLSuseold ? new Article($t) : Revision::newFromTitle($t); |
345 | | - if ($rev === null) |
| 347 | + if ($rev === null) { |
| 348 | + wfProfileOut( $fname ); |
346 | 349 | return "<!--Broken link in search results: ".$t->getDBKey()."-->\n"; |
| 350 | + } |
347 | 351 | |
348 | 352 | $text = $wgLSuseold ? $rev->getContent(false) : $rev->getText(); |
349 | 353 | $size = wfMsg('searchsize', sprintf("%.1f", strlen($text) / 1024), str_word_count($text)); |
— | — | @@ -612,6 +616,8 @@ |
613 | 617 | } else { |
614 | 618 | $host = $wgLuceneHost; |
615 | 619 | } |
| 620 | + global $wgOut; |
| 621 | + $wgOut->addHtml( "<!-- querying $host -->\n" ); |
616 | 622 | |
617 | 623 | global $wgUseLatin1, $wgContLang, $wgInputEncoding; |
618 | 624 | $enctext = rawurlencode( trim( $wgUseLatin1 |
— | — | @@ -637,7 +643,11 @@ |
638 | 644 | } |
639 | 645 | |
640 | 646 | wfDebug( "Fetching search data from $searchUrl\n" ); |
641 | | - $inputLines = @file( $searchUrl ); |
| 647 | + wfProfileIn( "$fname-contact-$host" ); |
| 648 | + $inputLines = explode( "\n", wfGetHTTP( $searchUrl ) ); |
| 649 | + wfProfileOut( "$fname-contact-$host" ); |
| 650 | + //$inputLines = @file( $searchUrl ); |
| 651 | + |
642 | 652 | if( $inputLines === false ) { |
643 | 653 | // Network error or server error |
644 | 654 | wfProfileOut( $fname ); |