Page 1 of 1

MySQL Query: how does MATCH work with PDO?

Posted: Thu Jun 11, 2015 5:15 am
by simonmlewis
We are having a few problems with our search results on web site.

For example, if you was looking for a shirt, and it was titled "White Shirt Brand", but you searched for "white shirt black collar", it would not find that product, because the title isn't what you searched on.

I'm use there use to be a good way to find it, so that the words "white" and "shirt" were in the criteria and it found it.

How does this work with PDO queries?

Re: MySQL Query: how does MATCH work with PDO?

Posted: Thu Jun 11, 2015 6:05 am
by requinix
Have you tried MATCH...AGAINST with some real queries? It might not behave quite how you want it to.

Anyway, there's nothing special about it with PDO. Prepared statement, plain query, it works just... normally.

Re: MySQL Query: how does MATCH work with PDO?

Posted: Thu Jun 11, 2015 6:10 am
by simonmlewis
I've tried "...OR MATCH(title) AGAINST (:search).
It works. Does give results that are not relevant, but if either word is in the title, it comes up, so I suppose it's bringing up the "correct" results.

Re: MySQL Query: how does MATCH work with PDO?

Posted: Thu Jun 11, 2015 7:03 pm
by requinix
It also tends to ignore words when a majority of rows contain it. Like if most said "Something Brand" then "Brand" in a search term would be ignored. But that may be desirable for you.