Page MenuHomePhabricator

Recommendation for browser search engine pattern
Closed, ResolvedPublic

Description

I've been going back between the following two entries for keyword-tab search engines from the address bar (e.g. "codesearch<Tab>search phrase<Return>").

https://codesearch.wmflabs.org/search/?q=%s
https://codesearch.wmflabs.org/search/?q=%S

The difference between the use of lowercase or uppercase S. The difference between these is that lowercase S uses percent-based url-encoding for the phrase, and uppercase S substitutes the phrase directly in the url.

Both of these have issues for me:

With lowercase S, a query is "foo=&" encoded as /search/?q=foo%3D%26 which is desirable and runs the query the same way I entered it before encoding. The problem is that use of a space (e.g. foo bar) results in /search/?q=foo+bar (using Chrome, latest stable), which is interpreted by Code Search as a literal plus sign instead of a space.

I don't know if there is a way to force the browser to use %20 for space encoding, as that would solve this problem.

It can be worked around by using uppercase S, which will pass the space as a literal part of the query, but then any special characters like ampersand and equals will be parsed as part of the url query string, instead of the value of a specific query parameter, and thus effectively drops part of the string. E.g. foo=&bar results in`/search/?q=foo=&bar` which surprisingly doesn't search for anything (why?), and foo&bar results (naturally) in a search just for foo as the ampersand terminates the value for q.

Event Timeline

Vvjjkkii renamed this task from Recommendation for browser search engine pattern to t9aaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from t9aaaaaaaa to Recommendation for browser search engine pattern.Jul 2 2018, 2:53 PM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.
Krinkle triaged this task as Medium priority.Jul 16 2018, 10:22 PM
Krinkle added a project: Upstream.
Krinkle moved this task from Backlog to Reported Upstream on the Upstream board.
Krinkle moved this task from Reported Upstream to Patch proposed upstream on the Upstream board.

Yep, thanks!

This was fixed upstream (https://github.com/hound-search/hound/pull/321) but we're not currently pulling upstream updates because their docker build is broken..

In any case, I believe this is also fixed in the new beta codesearch UI because it uses percent encoding properly.

Krinkle claimed this task.

Fixed in both stable and beta now.