mrkamel/search_cop

Some way to disable operator on string?

Opened this issue · 5 comments

My attribute has ":", "=" etc... I would like to disable operator on string.

well, i can offer to add escaping to the query syntax, such that you can search for

word1 word2\:word3 ...

then you are free to escape ":", "=", etc manually or via e.g. gsub ...

I found a workarround... use gsub to change non alphanumeric with blank space.. it seems working ok for while... but would be great a opition to disable it... I am using a autocomplete for when a full description is selected I serach for this...

... disabling it is not really an option, especially not for string fields only - as it's not possible to change the parser/grammar (treetop) on the fly. So, only option is a) add escaping feature or b) add additional (but reduced) grammar, where you can't search in specific fields and thus don't have to disable that.

I think i'll add escaping, as it make sense for every case.

Ok... escaping is a good option to.. because changing to blank spaces is generating extra sql

Can the escaping be added as an option so we dont have to do gsub on every search?

search_scope :search do
  option :escape_parser_operators
end