Fix highlighting of results when the search result does not return termMatches
authorStephan Gambke <s7eph4n@gmail.com>
Mon, 18 Aug 2014 15:55:51 +0000 (15:55 +0000)
committer[[mw:User:F.trott]] <gerritpatchuploader@gmail.com>
Mon, 18 Aug 2014 15:55:51 +0000 (15:55 +0000)
commite3a34617b275e10a8610bdda694e1d18c9e9e7df
tree7f2ebbc28096a04ea7e1b65a301595cfe11be317
parente6ca4c3b7fdbae2f2dbcf32c8d9f8d3e4f70777f
Fix highlighting of results when the search result does not return termMatches

If the search engine does not know the concept of serch terms the search
result object will just return an empty array as defined in class
SearchResultSet.

In this case SearchHighlighter::highlightSimple will place a span between
each and every byte (yes, byte, not character, it will break multibyte
chars).

This patch will just output the first few lines of a page if no search
terms are available for highlighting.

Note: Highlighting the page name in the case of title matches is
questionable, IMHO. It might make more sense for this case as well to
just return the first few lines of the page.

Change-Id: I276418f271855fb99443188f51cc076289c6ba0d
includes/search/SearchHighlighter.php
includes/search/SearchResult.php