This problem was first surfaced in [[ https://logstash.wikimedia.org/goto/1fee96f80e843fae8f3a7e80cc2ea724 | Logstash ]].
The AutocompleteLookupHandler mixin includes a number of regular expressions and calls to string-processing methods. Something in here is breaking when `"` characters are entered into the search field.
**Steps to Reproduce: **
* Go to Special:MediaSearch and enter a search term that is wrapped in quotes (single or multiple words, does not matter).
**Actual Results:**
* The autocomplete results fail to display
* Warnings and/or errors appear in the JS console, including:
`Uncaught TypeError: trimmedInput.match(...) is null` and
`jQuery.Deferred exception: result.match(...) is null`
**Expected Results:**
* Search terms containing quotes should display auto-complete results normally (see below for question about what "normally" means here).
On a related note, I'm noticing search results differ when quotes are present even when the search term is only a single word: `"dog"` vs `dog` will produce different results. This happens regardless of whether JS is enabled or not. What is considered "correct" behavior here?
This bug may be related to T277811
**Acceptance Criteria**
My assumption is that we simply don't want to provide autocomplete suggestions for terms that are wrapped in quotes (or partially wrapped in quotes, for example while the user is in the process of typing the full phrase), with the reasoning that users who are including `"` characters in their search term have some very specific phrase in mind and don't want auto-suggested alternatives. If this assumption is not correct, then this ticket probably needs to be re-visited.
Things to QA:
- [ ] Users pasting a complete phrase wrapped in quotes (`"united states"`) will not see any auto-complete suggestions, but the pending state in the search input will clear after a moment and searching will work normally without any errors.
- [ ] Users in the process of typing such a phrase (`"uni`, `"united`, etc) should see the same behavior as above
- [ ] Users entering non-quoted strings into the search field should see normal (unchanged) behavior with one or more autocomplete results displayed