Searching with quoted term doesn't highlight the whole term

Continuing the discussion from The term "ost.io" creates trouble for search:

I’d expect it to highlight the whole term, but it highlights just arbitrary words.

2 Likes

You don’t need the quotes for an exact term match :wink:


If this is an easy fix we should fix it @sam

2 Likes

Looks to me like the highlighter just needs to strip out the quotes.

It’s still not highlighting the quoted term and now it shows double quotes for the search term.

3 Likes

I want to get to fixing this but its a fairly involved fixed, the highlighter needs to understand this behavior, it only highlights words now not full terms.

I really, really want this fixed, it is pretty disastrous from a UI perspective, also I’m not even sure it’s searching for a full quoted phrase in this scenario?

Done per:

per:

https://github.com/discourse/discourse/commit/0791d740a634a70cb8ffb7f762f1a31353560209

I changed it so we only match whole words, centralized the highlighting code and deal with exact terms.

6 Likes

One interesting edge case here is that the really being in italics in your post breaks the algorithm.

Cause we match the index and then try to match raw, we are going to have to change it to try to do the exact match on a normalized text only version of the post.

3 Likes