Skip to content

[search] Fix corner cases when using quotes in filenames

Ismael Asensio requested to merge work/fix_quoted_filename into master

The filename term in a search query is enclosed into quotes. As the user can have additional quotes in the search term, there were several corner cases where the parsing would fail to correctly split the terms

New test cases have been added to cover this possibility Previous tests still passes to avoid regressions

BEFORE:

(filename/quoted) Compared values are not the same
Actual   (query.text()): "xyz\"\""
Expected (expectedText): "\"abc xyz\""

(filename/mixed) Compared values are not the same
Actual   (query.text()): "xyz\" tuv\""
Expected (expectedText): "\"abc xyz\" tuv"

(content+filename/quoted) Compared values are not the same
Actual   (query.text()): "abc xyz xyz\"\""
Expected (expectedText): "abc xyz filename:\"\"abc xyz\"\""

Merge request reports