Page MenuHomePhabricator

Allow searching for plain text in CodeSearch
Open, MediumPublicFeature

Description

Feature summary (what you would like to be able to do and where):

I would like to have an option to not have my search input interpreted as regex, but instead just use it as the actual search term.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):

Often when I search for functions or variables, I have to escape some characters (function\(\), \$wgDBname etc) for my search to work properly which is really annoying in my opinion.

image.png (537×1 px, 55 KB)

image.png (685×1 px, 141 KB)

Benefits (why should this be implemented?):

This would allow copy-pasting code directly to the search without the need to manually escape it.

Event Timeline

Pppery rescinded a token.
Pppery awarded a token.

I've done a bit of research into this, and it seems that this feature is already present in Hound: https://github.com/hound-search/hound/commit/ca5c7c8c1dc6753b0bbe2bdd0ad3c934969f7cf6 (adds a literal parameter which allows searching for plain text)
However, Codesearch is running an older commit of Hound, so that will probably need to be updated, then a second checkbox could be added below "Ignore case".

Until this is implemented properly, I've created a userscript that adds a plaintext search button next to the normal one that escapes any regex before submitting the query:
https://github.com/SomeMWDev/Userscripts/blob/main/codesearch-plain-search.user.js

Krinkle triaged this task as Medium priority.Sat, Feb 14, 1:13 AM
Krinkle moved this task from Backlog to Frontend on the VPS-project-Codesearch board.