X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/74c929b24b048c9f1e31e17db757ae4195cd7673..dc9cc5d707f5a612938cc9371614cc41c328fda2:/includes/SearchEngine.php diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 3ea0341d..e5392f7c 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -80,8 +80,13 @@ class SearchEngine { if (is_null($title)) return NULL; - if ( $title->getNamespace() == NS_SPECIAL || $title->isExternal() - || $title->exists() ) { + if ( $title->getNamespace() == NS_SPECIAL || $title->isExternal() || $title->exists() ) { + return $title; + } + + # See if it still otherwise has content is some sane sense + $article = MediaWiki::articleFromTitle( $title ); + if( $article->hasViewableContent() ) { return $title; } @@ -403,7 +408,7 @@ class SearchEngine { if($wgMWSuggestTemplate) return $wgMWSuggestTemplate; else - return $wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace={namespaces}'; + return $wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace={namespaces}&suggest'; } } @@ -1165,12 +1170,12 @@ class SearchHighlighter { continue; } --$contextlines; - $pre = $wgContLang->truncate( $m[1], -$contextchars, ' ... ' ); + $pre = $wgContLang->truncate( $m[1], -$contextchars ); if ( count( $m ) < 3 ) { $post = ''; } else { - $post = $wgContLang->truncate( $m[3], $contextchars, ' ... ' ); + $post = $wgContLang->truncate( $m[3], $contextchars ); } $found = $m[2];