Help needed with Server Side (MySQL) Search Improvement

Help needed with Server Side (MySQL) Search Improvement

kloskklosk Posts: 2Questions: 1Answers: 0
edited June 2017 in Free community support

Hi,
I recently launched a site making use of datatables (wpsearch.daniel-klose.com). It's weak point currently is the search, since it's using MySQL as its data source. For example searching for "woocommerce addons" should show a tool called "woocommerce product addons" but it doesn't since the MySQL search apparently can't apprehend these kind of search terms.

Some people said I should look into replacing the MySQL search with ElasticSearch. However, it seems very difficult to implement with Datatables. One project on Github has been abandoned and the forum doesn't really have any solutions in place neither.

Anyone can advise me what other options I have to achieve a better search/implement a working elastic search with MySQL?

Thank you!

Answers

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin

    Since you are using server-side processing, then yes, you would need to modify the server-side script to handle a smarter search.

    Perhaps the easiest option is to simply split the input string on whitespace characters and then use a LIKE expression on each component - e.g.:

    WHERE text LIKE '%woo%' AND text LIKE '%addons%'
    

    This is where you would need to make that change.

    I have written a bit of code for Editor's PHP libraries which implements that (it isn't enabled by default due to performance - the more terms the more searching of course). It isn't directly transplantable into the SSP class (which I presume you are currently using), but it might give you and idea of how to implement it. Code is available here.

    The other option is to do something like using ElasticSearch. I haven't done any work in that regard myself, but it is on my to do list, for whenever I get a chance to do it!

    Allan

  • kloskklosk Posts: 2Questions: 1Answers: 0

    Thanks Allan - Will give it a try!

This discussion has been closed.