Server Side search with multiple strings across multiple columns
Server Side search with multiple strings across multiple columns
deetimba
Posts: 5Questions: 2Answers: 0
Hey there,
what seems to work by default for client side implementation is not working for the server side tables: I would like to be able to search for: "London Black Engineer" returning me a list of people living in London (column city), named Black (column name) and being engineers (column job).
So far I have not been able to find a appropriate approach to it. Also said that I'm quite new to data tables.
How could I manage to have this enabled? Any ideas?
This discussion has been closed.
Answers
It is a pretty old question and you've probably found a solution for it. But since I am dealing with similar issues here is a solution I've just finished testing. I defined a field called "global_search_field" that contains a concatenation of a couple of fields. Now I can enter stuff like "LIBOR USD 3months" which is ref_rate plus currency plus ref_rate_period and it is being found. (But: "USD 3months LIBOR" isn't found with this unfortunately because Editor is obviously applying the complete search string to every field as a LIKE statement. If EDITOR were splitting the string into individual words and searched for LIKE '%USD%' OR LIKE '%3months%' OR LIKE '%LIBOR%' it would work but unfortunately it doesn't.
The global_search_field must be defined in Javascript as well even though I don't return it to the front-end (getFormatter returns space) and I guess also in the HTML. I use class "never" so that it isn't displayed and also make sure it doesn't show up in the colvis selection either.
@allan I tried something more complex for the concatenated field like this:
this works fine with MySQL but it doesn't work with Editor PHP. Editor doesn't seem to be able to handle DATE_FORMAT inside CONCAT. Is there a solution for this? And also are you planning to enhance server side search by using more differentiated LIKE statements in Editor's SQL?
HTML:
Javascript:
PHP:
of course it must be "LIKE '%USD%' AND LIKE '%3months%' AND LIKE '%LIBOR%'" in my note above.