Page MenuHomePhabricator

HighlightBuilder: Introduce a way to control the highlighting behaviors
Closed, ResolvedPublic

Description

It's currently extremely hard to control the highlighting behaviors of search:

  • only few keywords have dedicated support for highlighting
  • it's too hard for query builders to include additional data fetched from elastic

We should provide a fluent building process so that query building components can control the behavior of highlighting.
The ResultsType should not be decided too early.
Query components should declare:

  • the target output they want to populate:
    • standard ones: titleSnippet, textSnippet, redirectSnippet which are understood by the default search results UI
    • custom ones (possibly reusing SearchResult::$extensionData)
  • A priority may also be provided to handle conflicting targets: words in the query may want highlight the redirectsSnippet but if subpageof is used and it matches a redirect it's perhaps preferable to highlight the redirect that subpageof matched.
  • A transformation mechanism, the builder should accept a method to transform the result returned from elastic into the target string.

Event Timeline

dcausse triaged this task as Medium priority.Mar 20 2018, 9:44 AM
dcausse created this task.

Change 520851 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/extensions/CirrusSearch@master] [WIP] Add FetchPhaseConfigBuilder

https://gerrit.wikimedia.org/r/520851

Change 520851 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Add FetchPhaseConfigBuilder

https://gerrit.wikimedia.org/r/520851

Change 534170 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/extensions/CirrusSearch@master] Add CirrusSearchResultBuilder and ArrayCirrusSearchResult

https://gerrit.wikimedia.org/r/534170

Change 537457 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/extensions/CirrusSearch@master] Start using priority of highlighted fields

https://gerrit.wikimedia.org/r/537457

Change 534170 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Add CirrusSearchResultBuilder and ArrayCirrusSearchResult

https://gerrit.wikimedia.org/r/534170

Change 538945 had a related patch set uploaded (by DCausse; owner: DCausse):
[mediawiki/extensions/CirrusSearch@master] Add HighlightingFeature

https://gerrit.wikimedia.org/r/538945

Change 537457 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Start using priority of highlighted fields

https://gerrit.wikimedia.org/r/537457

Change 538945 merged by jenkins-bot:
[mediawiki/extensions/CirrusSearch@master] Add HighlightingFeature

https://gerrit.wikimedia.org/r/538945