Closed Bug 483812 Opened 11 years ago Closed 11 years ago

Search terms should appear bolded in search results


( :: General, defect, P1, major)



(Not tracked)



(Reporter: stephend, Assigned: paulc)




(Whiteboard: sumo_only)


(2 files)

Steps to Reproduce:

1. Load
2. Look for "bookmark" in the search results

Expected Results:

"bookmark" should appear bolded
One of those search switch bugs that would be really really nice to have. Eric? :)
Assignee: nobody → smirkingsisyphus
Priority: -- → P1
Target Milestone: --- → 1.1
How fancy are we getting here?

Exact matches only? Plurals?...transitive verbs...gerunds?
Err...I meant verb tenses when I said transitive verbs.

Ideally like Google is doing it, which is to highlight the individual words:

This is how our current search engine does it on SUMO prod, too.
The current SUMO uses google, doesn't it?

At the very least, it will bold the individual terms. If including plurals, gerunds, and verb tenses doesn't make things buggy, I'll include that too.
Target Milestone: 1.1 → 1.0
Blocks: 405028
Assignee: smirkingsisyphus → paul.craciunoiu
Works for individual words.
r23761 / r23762

Other things, like plurals, gerunds, and so on are language-based and so ... I could maybe give it a try for English only. Either way, it'll be a hassle unless there's some large database out there that we can use.
Closed: 11 years ago
Resolution: --- → FIXED
Yeah that sounds challenging to say the least. Wasn't sure what Eric meant when he said he could include that too. I have no idea how to bend e.g. a Japanese noun. :)
As I told Paul, I was just going to "wing it."
Just so we're clear, this bolds all parts of words that match the search.
For example, on:

Both "it" and the "it" part of "item" are bolded in the 2nd result. I could potentially add an exception for languages that have words separated by spaces (or punctuation). I think japanese is not one of them, for example.

So, yeah, let me know how far we need to go and I can try to see :)
Search phrase highlighting is not case-sensitive.Reopening..
Resolution: FIXED → ---
We need a better replace function. Anyone got more experience with preg_match?
Needs to replace case-sensitive with case-sensitive.
I need help! :) comments, 11 and 12-should say case insensitive.
Target Milestone: 1.0 → 1.0.2
Updated. Now the search terms are bolded in title and summary as entire words. A word is considered anything that's not followed or preceded by punctuation or spaces.

This will need some good amount of testing once newsearch works again (seems that currently it doesn't on staging).

r24213 / r24215
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Verified FIXED on; we'll need to keep testing, as you say, to look for regression and/or other lurking bugs.
Empty queries bold entire summaries.
Resolution: FIXED → ---
r24426 / r24427
Good catch Eric. Thanks.
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Just as a heads up...

When/if the patch from bug 489277 lands, this will be broken for languages with  multibyte encodings, like Japanese.

Maybe we could move to something simpler (at line 635), like $preg_repl = "/(\b" . preg_quote($enc_q)."\b)/Ui";
(In reply to comment #19)
> Maybe we could move to something simpler (at line 635), like $preg_repl =
> "/(\b" . preg_quote($enc_q)."\b)/Ui";
The idea of that was to bold the entire word, and yes, I must've missed the \b option. It's definitely better. I should wait for that patch to land first :)
Thanks again Eric!
Committed Eric's solution to fix bug 489372.
Whiteboard: sumo_only
You need to log in before you can comment on or make changes to this bug.