New issue
Advanced search Search tips

Issue 602450 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature



Sign in to add a comment

Omnibox autocomplete does not fully support search engines where terms are part of the query parameter

Project Member Reported by jbroman@chromium.org, Apr 11 2016

Issue description

Version: ToT (96452d073371da1e1ab7eb1ef724df0926f76547-refs/heads/master@{#386464})
OS: All

What steps will reproduce the problem?
(1) Create a custom search engine with a keyword (e.g. "cr"), whose URL is something like "http://www.google.com/search?q=%s@chromium.org".
(2) Repeatedly enter "cr jbroman" into the omnibox, hitting enter each time.
(3) Eventually, it will offer to autocomplete (HistoryQuickProvider). However, the autocomplete suggestion will be "jbroman@chromium.org", choosing which leads to a search for "jbroman@chromium.org@chromium.org".

Debugging this, it looks like TemplateURLRef assumes that the replacements it provides will always fill a full URL component (e.g. query param). While going from query to URL works fine (it will substitute in the query parameter, leaving the suffix intact), when going in the opposite direction (TemplateURLRef::ExtractSearchTermsFromURL) it just locates the corresponding query key ("q"), and takes the whole value ("jbroman@chromium.org") as the extracted value.

Ideally, it would extract "jbroman" (being aware of the prefix/suffix). Another, less convenient, alternative might be not to offer autocomplete suggestions for search engines of this type.

I'd fix this myself, but it seems to have larger implications for components/search_engines/.
 
This sort of case is super rare, so I'm not too worried that fixing this would break things.  If you send me a review for the fix, I can check to ensure the implementation of the fix doesn't cause any other problems.
Owner: jbroman@chromium.org
Status: Started (was: Untriaged)
Project Member

Comment 3 by bugdroid1@chromium.org, Apr 21 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/508320252e351bc010cc25d837b55baf6d0d22c4

commit 508320252e351bc010cc25d837b55baf6d0d22c4
Author: jbroman <jbroman@chromium.org>
Date: Thu Apr 21 23:53:00 2016

Support fixed prefixes and suffixes when extracting terms from search template URLs.

This causes autocompletions for custom search engines where the query parameter
has some prefix or suffix to work correctly, instead of duplicating it.

BUG= 602450 
TEST=components_unittests:TemplateURLTest.ExtractSearchTermsWithPrefixAndSuffix

Review URL: https://codereview.chromium.org/1902263002

Cr-Commit-Position: refs/heads/master@{#388958}

[modify] https://crrev.com/508320252e351bc010cc25d837b55baf6d0d22c4/components/search_engines/template_url.cc
[modify] https://crrev.com/508320252e351bc010cc25d837b55baf6d0d22c4/components/search_engines/template_url.h
[modify] https://crrev.com/508320252e351bc010cc25d837b55baf6d0d22c4/components/search_engines/template_url_unittest.cc

Status: Fixed (was: Started)

Sign in to add a comment