Closed Bug 483812 Opened 11 years ago Closed 11 years ago

Search terms should appear bolded in search results

Categories

(support.mozilla.org :: General, defect, P1, major)

x86
All

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stephend, Assigned: paulc)

References

()

Details

(Whiteboard: sumo_only)

Attachments

(2 files)

Steps to Reproduce:

1. Load http://support-stage.mozilla.org/tiki-newsearch.php?where=d&locale=en-US&q=bookmark&sa=
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.

...sigh.
Ideally like Google is doing it, which is to highlight the individual words: http://www.google.se/search?q=firefox+support+help&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:sv-SE:official&client=firefox-a

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.
Status: NEW → RESOLVED
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:
https://support-stage.mozilla.org/tiki-newsearch.php?locale=en&q=it+feed&where=all&sa=&filter_lang=1&l=en&en_too=1&lastmodif=0&type=0&author=

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..
Status: RESOLVED → REOPENED
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! :)
Correction:Oops..my 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
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Verified FIXED on https://support-stage.mozilla.org/tiki-newsearch.php?where=d&locale=en-US&q=bookmark&sa=; we'll need to keep testing, as you say, to look for regression and/or other lurking bugs.
Status: RESOLVED → VERIFIED
Empty queries bold entire summaries.

https://support-stage.mozilla.org/tiki-newsearch.php?locale=&q=&where=all&sa=&filter_lang=1&l=ar&en_too=1&lastmodif=0&type=0&author=
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
r24426 / r24427
Good catch Eric. Thanks.
Status: REOPENED → RESOLVED
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.