tsolucio / corebos

core Business Operating System. An OPEN SOURCE business application that helps small and medium business handle all the day to day tasks.
https://corebos.com
151 stars 142 forks source link

Underscore not working in search #1547

Closed maliknajjar closed 1 year ago

maliknajjar commented 1 year ago

When trying to search the string "_text" it will consider the underscore as a wildcard that represents any value. in order to fix this we need to escape the underscore in the string.

joebordes commented 1 year ago

Shouldn't we have that escapeUnderscores also in some other checks like starts with and ends with?

maliknajjar commented 1 year ago

@joebordes yes .. actually, I think maybe its better to even escape the $value variable itself. because we should not give the user the ability to use the underscore wildcard. and I don't think that query generator use it anywhere. wdyt?

joebordes commented 1 year ago

@joebordes yes .. actually, I think maybe its better to even escape the $value variable itself. because we should not give the user the ability to use the underscore wildcard. and I don't think that query generator use it anywhere. wdyt?

I don't agree because when they do an exact search we will want to have that underscore. I mean if someone is using the equals or not equals, I think we need to permit that underscore "as is", no?

maliknajjar commented 1 year ago

yes I agree. because the "_" wildcard works only when used with the LIKE keyword. so how about escaping the underscore when the LIKE keyword is used?

joebordes commented 1 year ago

yes, correct. that is the idea. I shared a link to the QG code section where starts/ends/contains are, there are probably some others there that need that escape

maliknajjar commented 1 year ago

ok, I will add it to them too

joebordes commented 1 year ago

LGTM. I'll wait to see the unit tests before merging. Ok?

maliknajjar commented 1 year ago

yes .. I will create them

joebordes commented 1 year ago

thanks!