Server-Side and Search Filter Regex

Server-Side and Search Filter Regex

lucas fantilucas fanti Posts: 1Questions: 1Answers: 0

I'm from Brazil, sorry for the English.

When I eat serverSide with true, I can't search for multiple words anymore, can you help me with the code below?

I really need, even on server-side, to be able to search in regex mode, that is, for several words.

How can the code below be modified, so that I can?

/ *
* Filtering
* NOTE this does not match the built-in DataTables filtering which does it
* word by word on any field. It's possible to do here, but concerned about efficiency
* on very large tables, and MySQL's regex functionality is very limited
* /
$ sWhere = "";
if (isset ($ _ GET ['sSearch']) && $ _GET ['sSearch']! = "") {
$ sWhere = "WHERE (";
for ($ i = 0; $ i <count ($ columns); $ i ++) {
if (isset ($ _ GET ['bSearchable _'. $ i]) && $ _GET ['bSearchable _'. $ i] == "true") {
$ sWhere. = "". $ columns [$ i]."LIKE: search OR";
}
}
$ sWhere = substr_replace ($ sWhere, "", -3);
$ sWhere. = ')';
}

// Individual column filtering
for ($ i = 0; $ i <count ($ columns); $ i ++) {
if (isset ($ _ GET ['bSearchable _'. $ i]) && $ _GET ['bSearchable _'. $ i] == "true" && $ _GET ['sSearch _'. $ i]! = '') {
if ($ sWhere == "") {
$ sWhere = "WHERE";
}
else {
$ sWhere. = "AND";
}
$ sWhere. = "". $ columns [$ i]."LIKE: search". $ i. "";
}
}

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Yep, it's not supported in the pre-supplied scripts. This thread here should help, there's a discussion on implementing it.

    Colin

This discussion has been closed.