Closed Bug 1636696 Opened 6 months ago Closed 5 months ago

Highlight suggestions only if the typed token prefixes a word in the suggestion

Categories

(Firefox :: Address Bar, enhancement, P2)

enhancement
Points:
3

Tracking

()

RESOLVED FIXED
Firefox 78
Iteration:
78.1 - May 4 - May 17
Tracking Status
firefox78 --- fixed

People

(Reporter: harry, Assigned: harry)

References

(Blocks 1 open bug)

Details

(Keywords: parity-chrome)

Attachments

(4 files, 1 obsolete file)

Attached image chrome_tail.png

+++ This bug was initially created as a clone of Bug #1626891 +++

In its initial implementation, tail suggestions follow the same highlighting rules as normal suggestions. This means that any part of the tail that matches the typed string is not highlighted. Instead, we should highlight the entire tail after the end of the typed string, plus any words that changed in the string. See the attached screenshots for a comparison of Chrome and Firefox behaviour.

Attached image firefox_tail_v1.png

Attached is Firefox behaviour. Note that this behaviour is not yet live in Nightly, but it is how bug 1626897 will land.

I'm leaning towards a more general approach to this bug that encompasses both tail and normal suggestions. It appears that one consequence of having Google's tail suggestions enabled is that Google also starts to return more normal suggestions as the user approaches a tail suggestion but that are still returned as a normal result. One great example I found that highlights (pun intended) some odd behaviour in our highlighting code is the query "indian holy sites in i". Google returns two suggestions, neither of which are returned to our current Google client ID:

  1. "hindu holy sites in india" (normal suggestion)
  2. "... ireland" (tail suggestion)

Our highlighting doesn't deal well with the first suggestion. We get:

h in du holy sites in in d i a

We match match the word "in" to the in in "hindu" and the trailing i to the second i in "india". This is consistent with our other highlighting code but doesn't really uphold the spirit of what we're trying to do with highlighting. After all, it's more important that Google suggested the word "hindu" to replace "indian" and it's irrelevant (imo) that part of the typed string matches the second i in "india".

My patch only highlights if the part of the typed search query we're matching against is after a space or at the beginning of the string. It's a small change but I think it gives better highlighting in most situations! I'm looking for thoughts before I flesh out this patch. With the patch we get:

hindu holy sites in in dia

Attached is a screenshot of the query in comment 1.

BTW, the Phabricator stack includes a small patch that enables experimental tail suggestions, which should be applied if you're testing this one.

Assignee: nobody → htwyford
Status: NEW → ASSIGNED

This makes a lot of sense, thank you for doing it. Suggestions are very different from local results and deserve a different treatment.

(In reply to Harry Twyford [:harry] from comment #4)

My patch only highlights if the part of the typed search query we're matching against is after a space

What does "after a space" mean here?

or at the beginning of the string

I suppose you mean we highlight the remaining part of the string, so "o" => "o<ntario>"

From the screenshot and examples we seem to highlight a word if it is not found in the original search string, or we highlight the tail of a word if it starts with a word in the original string.

(In reply to Marco Bonardo [:mak] from comment #5)

This makes a lot of sense, thank you for doing it. Suggestions are very different from local results and deserve a different treatment.

(In reply to Harry Twyford [:harry] from comment #4)

My patch only highlights if the part of the typed search query we're matching against is after a space

What does "after a space" mean here?

I mean that when we're comparing a typed token to the suggestion, we ensure that the part of the suggestion being matched to the token is either the first word in the string, or comes right after a space and is thus matching the beginning of a word.

I suppose you mean we highlight the remaining part of the string, so "o" => "o<ntario>"

From the screenshot and examples we seem to highlight a word if it is not found in the original search string, or we highlight the tail of a word if it starts with a word in the original string.

Yep!

Summary: Improve tail suggestion highlighting → Highlight suggestions only if the typed token prefixes a word in the suggestion
Iteration: --- → 78.1 - May 4 - May 17
Attachment #9147784 - Attachment description: Bug 1636696 - WIP - Modifed highlighting. → Bug 1636696 - Highlight suggestions only if the typed token prefixes a word in the suggestion. r?adw
Attachment #9147782 - Attachment is obsolete: true
Pushed by htwyford@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d4d2791e9a9d
Highlight suggestions only if the typed token prefixes a word in the suggestion. r=mak
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 78
You need to log in before you can comment on or make changes to this bug.