X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchResult.php;h=aeaba8df324c3af6372ca0b9391a0f26f856d19f;hb=9b3f84e763810ab101bfc2bdcee7a319eb73218c;hp=453211be96a9b5a734dbf32be890680b134cf7ae;hpb=4169b4f42502ca1956f7a7253b5f54e1901e7821;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchResult.php b/includes/search/SearchResult.php index 453211be96..aeaba8df32 100644 --- a/includes/search/SearchResult.php +++ b/includes/search/SearchResult.php @@ -61,35 +61,6 @@ class SearchResult { return $result; } - /** - * Return a new SearchResult and initializes it with a row. - * - * @param object $row - * @return SearchResult - */ - public static function newFromRow( $row ) { - $result = new self(); - $result->initFromRow( $row ); - return $result; - } - - public function __construct( $row = null ) { - if ( !is_null( $row ) ) { - // Backwards compatibility with pre-1.17 callers - $this->initFromRow( $row ); - } - } - - /** - * Initialize from a database row. Makes a Title and passes that to - * initFromTitle. - * - * @param object $row - */ - protected function initFromRow( $row ) { - $this->initFromTitle( Title::makeTitle( $row->page_namespace, $row->page_title ) ); - } - /** * Initialize from a Title and if possible initializes a corresponding * Revision and File. @@ -142,13 +113,6 @@ class SearchResult { return $this->mImage; } - /** - * @return float|null If not supported - */ - function getScore() { - return null; - } - /** * Lazy initialization of article text from DB */ @@ -173,11 +137,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 ); } } @@ -244,13 +213,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) */