You are here:  » Narrowing down search results

Narrowing down search results

Submitted by twdesigns on Fri, 2014-10-03 16:17 in

I thought this had been discussed before but I couldn't find it.

Right now on my site if I search for Blood Pressure Monitor it also pulls in Pressure Mattresses.

I was going to create a custom A to Z list based off search results but I'm trying to filter out unrelated content.

What would be the best route to take for this?

Submitted by support on Fri, 2014-10-03 16:32


You could implement BOOLEAN MODE search for full text queries (where all keywords are > 3 characters, otherwise search is logic AND by default) which will require that all keywords are present. To give this a go, edit pto_search.php and look for the following code beginning at line 186:

  $pto_searchSelect .= ",MATCH ".$matchFields." AGAINST ('".$wpdb->escape($parts[0])."') AS relevance";
  $where = "MATCH ".$matchFields." AGAINST ('".$wpdb->escape($parts[0])."')";

...and REPLACE with:

  $match = "+".str_replace(" "," +",$parts[0]);
  $pto_searchSelect .= ",MATCH ".$matchFields." AGAINST ('".$wpdb->escape($match)."' IN BOOLEAN MODE) AS relevance";
  $where = "MATCH ".$matchFields." AGAINST ('".$wpdb->escape($match)."' IN BOOLEAN MODE)";

Hope this helps!


Submitted by twdesigns on Fri, 2014-10-03 20:30

You my friend are a lifesaver and sometimes I wonder if you're even real LOL. So helpful and patient with all these questions we ask.

Again Thank you!