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.
// 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 );
}
}
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)
*/