mediawiki-extensions-Visual.../modules/ve-mw
Thiemo Kreuz 1a37edc53f Move exact matches to the top in template search
This code detects a few edge-cases:

1. When some search results are exact matches, make sure they
are always at the very top.

2. When the prefixsearch API is used, e.g. as a fallback,
redirects show up as a separate metadata structure outside of
the pages array. Consider these and stop if there is already
an exact match.

3. CirrusSearch returns redirects as part of the pages array.
When there is an exact match, make these redirects separate
options and add them to the top.

All of this is case-insensitive, on purpose. In case two
templates with different capitalization exist, we rely on
the backend to return both. The code introduced here is fine
with this.

Notes:
* This doesn't guarantee an exact match is always there. This
  requires an additional HTTP request and is done in the next
  patch.
* I tried to write unit tests for this, but gave up. The setup
  is complicated. An isolated unit test would not test much
  anyway. Better test this on-wiki.

Bug: T274903
Change-Id: I64e1b5633e7b878a4d0d23d66229ca87e69d0045
2021-05-31 09:54:39 +02:00
..
ce Remove/fix a few small pieces of unused code 2021-05-21 11:43:45 +00:00
dm Remove/fix a few small pieces of unused code 2021-05-21 11:43:45 +00:00
init Merge "ArticleTarget: Always set fromEditedState when preloaded is true" 2021-05-25 20:24:29 +00:00
preinit Merge "Remove obsolete vendor prefixed properties" 2021-05-18 01:25:08 +00:00
tests Show redirects as part of description in template search 2021-05-27 12:40:51 +02:00
themes
ui Move exact matches to the top in template search 2021-05-31 09:54:39 +02:00