Remove "related" searches
[lhc/web/wiklou.git] / includes / search / SearchResult.php
index d51bff7..c6d5d4f 100644 (file)
@@ -166,11 +166,16 @@ class SearchResult {
 
                // TODO: make highliter take a content object. Make ContentHandler a factory for SearchHighliter.
                list( $contextlines, $contextchars ) = SearchEngine::userHighlightPrefs();
+
                $h = new SearchHighlighter();
-               if ( $wgAdvancedSearchHighlighting ) {
-                       return $h->highlightText( $this->mText, $terms, $contextlines, $contextchars );
+               if ( count( $terms ) > 0 ) {
+                       if ( $wgAdvancedSearchHighlighting ) {
+                               return $h->highlightText( $this->mText, $terms, $contextlines, $contextchars );
+                       } else {
+                               return $h->highlightSimple( $this->mText, $terms, $contextlines, $contextchars );
+                       }
                } else {
-                       return $h->highlightSimple( $this->mText, $terms, $contextlines, $contextchars );
+                       return $h->highlightNone( $this->mText, $contextlines, $contextchars );
                }
        }
 
@@ -237,13 +242,6 @@ class SearchResult {
                return strlen( $this->mText );
        }
 
-       /**
-        * @return bool If hit has related articles
-        */
-       function hasRelated() {
-               return false;
-       }
-
        /**
         * @return string Interwiki prefix of the title (return iw even if title is broken)
         */