cakephp-datatables icon indicating copy to clipboard operation
cakephp-datatables copied to clipboard

No results returned when searching a column using regex OR condition

Open ZackaryMurphy opened this issue 8 years ago • 1 comments

Using the column search function as shown here: https://datatables.net/reference/api/column().search() with a regex of 'value|value2|value3' returns nothing because the plugin makes no attempt to split regex searches, so instead of a query of where col like %value% or col like %value2% ...etc, the produced sql is of the form where col like %value|value2|value3%. This issue would likewise extend to any form of regex searching with the plugin.

ZackaryMurphy avatar Jan 18 '17 20:01 ZackaryMurphy

In general, the plugin does not support all client-side features of datatables on the server side (e.g. 'smart search'). However regex searching is a functionality that is general enough that it would merit being supported.

In this case my preferred solution would be to pass the regex to the database. MySQL and PostgreSQL support regex search and I would expect others to do so, to. However, Cake's ORM currently does not wrap it so we would need to write our own, database-specific, code for it.

Are you interested in contributing to this significant work, e.g. preparing a pull request?

ypnos-web avatar Jan 18 '17 21:01 ypnos-web