Strip leading and trailing quote from search query

If you search for a phrase, it’s natural to assume that you should wrap your query string in quotation marks, since this is commonly understood by various search engines (for instance, Google, and the Manticore engine used by Tatoeba) to indicate that the string should match that set of words in the specified sequence. But at Clozemaster, quotation marks seem not to be handled well.

For instance, if you’re looking for the sequence:

je ne le suis pas

in French, you’ll find it only if you type:

je ne le suis pas

Searching for this:

“je ne le suis pas”

will not find any sentences.

Instead, it seems that a single quotation mark finds sentences that contain any quotation mark, but a phrase wrapped in quotation marks won’t find any sentences, even those that match the quote-wrapped pair. For instance, searching in the “French from English” collection for a single quotation mark in the “Translation” context:


will find such sentences as these:

“J’ai envie de jouer aux cartes.” “Moi aussi.”
« Elle aime la musique. » « Moi aussi. »

(Interestingly enough, a search for straight quotes finds guillemets – French-style quotes – as well, which is nice.)

But a search for this:

“Moi aussi.”

comes up empty, even though we know there is a sentence whose translation contains it.

Since Clozemaster already seems to treat an unwrapped string as if it were wrapped in quotes (that is, the words are only matched if they occur in the specified sequence), I believe that if a query string contains a leading and a trailing quote, they should be stripped before performing the search. It would also be nice to look into fixing the various other quirks I noted.