r10639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10638‎ | r10639 | r10640 >
Date:01:45, 20 August 2005
Author:timstarling
Status:old
Tags:
Comment:
profiling
Modified paths:
  • /trunk/extensions/LuceneSearch.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LuceneSearch.php
@@ -111,6 +111,7 @@
112112 $fname = 'LuceneSearch::execute';
113113 wfProfileIn( $fname );
114114 $this->setHeaders();
 115+$wgOut->addHTML("<!-- titlens = ". $wgTitle->getNamespace() . "-->");
115116
116117 foreach(SearchEngine::searchableNamespaces() as $ns => $name)
117118 if ($wgRequest->getCheck("ns" . $ns))
@@ -281,6 +282,7 @@
282283 $wgOut->addHTML($this->showFullDialog($q));
283284 }
284285 $wgOut->setRobotpolicy('noindex,nofollow');
 286+ $wgOut->setArticleRelated(false);
285287 wfProfileOut( $fname );
286288 }
287289
@@ -324,7 +326,7 @@
325327 function showHit($result, $terms) {
326328 $fname = 'LuceneSearch::showHit';
327329 wfProfileIn($fname);
328 - global $wgUser, $wgContLang, $wgLSuseold;
 330+ global $wgUser, $wgContLang, $wgLSuseold, $wgTitle, $wgOut;
329331
330332 $t = $result->getTitle();
331333 if(is_null($t)) {
@@ -341,8 +343,10 @@
342344 $link = $this->mSkin->makeKnownLinkObj($t, '');
343345
344346 $rev = $wgLSuseold ? new Article($t) : Revision::newFromTitle($t);
345 - if ($rev === null)
 347+ if ($rev === null) {
 348+ wfProfileOut( $fname );
346349 return "<!--Broken link in search results: ".$t->getDBKey()."-->\n";
 350+ }
347351
348352 $text = $wgLSuseold ? $rev->getContent(false) : $rev->getText();
349353 $size = wfMsg('searchsize', sprintf("%.1f", strlen($text) / 1024), str_word_count($text));
@@ -612,6 +616,8 @@
613617 } else {
614618 $host = $wgLuceneHost;
615619 }
 620+ global $wgOut;
 621+ $wgOut->addHtml( "<!-- querying $host -->\n" );
616622
617623 global $wgUseLatin1, $wgContLang, $wgInputEncoding;
618624 $enctext = rawurlencode( trim( $wgUseLatin1
@@ -637,7 +643,11 @@
638644 }
639645
640646 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+
642652 if( $inputLines === false ) {
643653 // Network error or server error
644654 wfProfileOut( $fname );

Status & tagging log