Page MenuHomePhabricator

Search suggestions should only highlight the first match in the title
Closed, ResolvedPublic


Strings that occur twice in a name of an article are highlighted twice.
Steps to reproduce:

Go to the English wikipedia, and type

A: *A*frican *A*merican (U.S. Census) is highlighted
B: *BB*C is highlighted
J J: *J*. *J*onah *J*ameson

Or go to the German wikipedia type
Br: *Br*itish *Br*oadcasting Corporation is highlighted

Expected behavior: Only the first occurrence of the letters typed in should get highlighted.

Version: 1.22.0
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:20 PM
bzimport added a project: MediaWiki-Search.
bzimport set Reference to bz25187.
bzimport added a subscriber: Unknown Object (MLST).

Thehelpfulonewiki wrote:

Reassign to default per bug 37789

SimpleSearch issues => Moving to Vector (as per $wgVectorUseSimpleSearch)

The whole mess is actually in core.

(This is still happening, as described in comment 0.)

maddiemadan wrote:

The bug is still reproducible. All the occurrences gets highlighted.

Created attachment 16337
Screenshot of bug.


Screen_Shot_2014-09-01_at_18.25.52.png (546×514 px, 54 KB)

Is this really a bug? It seems like a preference. I personally prefer all instances of my search string to be highlighted. It's a little silly when your query-so-far is only one letter, but it's not bad when you have longer strings.

I might argue that only the last word in the query should make a partial-word match, so that when searching for a ma only the whole word a should be highlighted (rather than both intial a's in A Matter of Life and Death.

On the other hand, maybe people do search for partial words (spelling is often hard), and so even the partial matches are useful (when they are more than one letter). Stranger things have happened.

debt subscribed.

Hi @Schnark - I'm closing this ticket as 'invalid' due to it appears to be a preference related issue rather than a bug.

I think this is a valid issue with MediaWiki core's built-in search suggestions, which are just a simple prefix search, so it doesn't make sense to highlight anything other than the prefix.

For CirrusSearch, the default highlights are in fact not smart enough (e.g. they don't account for misspelling correction or accent folding), and the highlighting would have to be done server-side anyway to make any sense (T62976).

As matmarex said: This is a prefix search. It makes sense to highlight the prefix, but if the search term occurs somewhere later in the title, this is just a coincidence. It also makes it hard to see which letter you should type next:

alex.png (276×306 px, 16 KB)

To continue, you have to type "n", though the next letter following the highlighted part is an "o".

Deskana lowered the priority of this task from Low to Lowest.Sep 13 2016, 8:54 PM
Deskana subscribed.

Given that this box performs a prefix search on article titles, I agree that this behaviour is unintuitive. That said, this isn't a super pressing issue; it's unintuitive and somewhat misleading, but it's not particularly incorrect. Lowering priority accordingly.

Aklapper subscribed.

Previous comments imply that this is not non-controversial, hence removing good first task tag.
I see the same behavior when using "Modern" instead of "Vector" skin hence removing the Vector (legacy skin) project tag.

Change 327900 had a related patch set uploaded (by Bartosz Dziewoński):
jquery.suggestions: Only highlight prefix matches

Change 327900 merged by jenkins-bot:
jquery.suggestions: Only highlight prefix matches