Hi David
To make search more relevant (so that search result is based on title, merchant,category, brand), I did the customization as describe in node/4184 of pricetapestry.com forum.
It worked OK in my other PT site (joomla +PT) but it is not working for new site(WP +PT Plugin).
same customization should work for new site too, right?
Regards
Hassan
Thanks David
I tried the above changes including the setting. But search result are unchanged. When enter merchant name it should return that merchant's products but it is not doing that.
My site: {link saved}
Merchants:
ABIT Computers
Cable Chick
Camera Lenses Direct
Camera Paradise
ChevronTechnologies
Circuit Central
Regards
Hassan
Hello Hassan,
I just checked it on my test server and it worked as expected, please could you email me your modified pto_search.php and I'll check it out against that version and add any debug code if necessary...
Cheers,
David.
Hi David,
I set these up with:
$where .= "search_name LIKE '%".$wpdb->escape($word)."%'";
$where .= "OR brand LIKE '%".$wpdb->escape($word)."%'";
$config_useFullText to FALSE
But the usefulltext to false slows it down a lot.
Thx
Henk
Hi Henk,
You could add a full text index on (name,brand). To add the index, use the following dbmod.php script in the Price Tapestry installation folder:
<?php
require("includes/common.php");
$sql = "CREATE FULLTEXT INDEX name_brand ON `".$config_databaseTablePrefix."products` (name,brand)";
database_queryModify($sql,$result);
print "Done.";
?>
Then in pto_search.php look for the following code at line 253:
$matchFields = "name";
...and REPLACE with:
$matchFields = "name,brand";
You can then re-enable Use Full Text. Your initial modification is still required to handle searches that don't invoke the full text index (any word in the query <= 3 characters) but this should speed things back up for you!
Cheers,
David.
--
PriceTapestry.com
This runs well, is it possible to make it when someone search for:
shoes nike basketball
nike is a 100% hit in the brand filter so make this one the "master"
then search for shoes and basketball
I hope you understand this one :)
Cheers Henk
Hello Henk,
What you could do is scan each word in the query for an exact brand match (this will be fast as fully indexed) and then set-up a $priceWhere clause for the brand, and also remove it from the keyword list. In pto_search.php look for the following code around line 214:
$words = explode(" ",$parts[0]);
...and REPLACE with:
$words = explode(" ",$parts[0]);
if ((count($words)>2) && !$pto_brandFilter)
{
$newwords = array();
$brandIns = array();
foreach($words as $word)
{
$sql = "SELECT id FROM `".$pto_config_databaseTablePrefix."products` WHERE brand='".$wpdb->escape($word)."' LIMIT 1";
if ($wpdb->query($sql))
{
$brandIns[] = "'".$wpdb->escape($word)."'";
}
else
{
$newwords[] = $word;
}
}
if (count($brandIns))
{
$pto_priceWhere .= " AND brand IN (".implode(",",$brandIns).") ";
}
$words = $newwords;
}
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi Hassan,
To make the equivalent modification for the plugin, look for the following code at line 266 in pto_search.php:
$where .= "search_name LIKE '%".$wpdb->escape($word)."%'";
..and REPLACE with:
$where .= "search_name LIKE '%".$wpdb->escape($word)."%'";
$where .= "OR merchant LIKE '%".$wpdb->escape($word)."%'";
$where .= "OR category LIKE '%".$wpdb->escape($word)."%'";
$where .= "OR brand LIKE '%".$wpdb->escape($word)."%'";
...and don't forget to change $config_useFullText to FALSE under wp-admin > Settings > PriceTapestry.org > External....
Cheers,
David.