You are here:  » Searching error

Support Forum



Searching error

Submitted by zlomennypez on Wed, 2012-03-07 11:41 in

I have problem, that searching some product don´t show results.

Web: {link saved}

If you want search: Kočárek - No results

If you want to search: Dorjan - there are results with name Kočárek dorjan.

Can you help me, that it could give me right results in searching this and another products?

Thank you.

Submitted by support on Wed, 2012-03-07 11:56

Hi,

It looks like it may be down to the database connection character set. I see that your site is running in utf-8. In includes/database.php look for the following code at line 14:

    $link = @mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword);

...and REPLACE with:

    $link = @mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword);
    mysql_set_charset("utf8",$link);

And finally the following (same) code at line 47:

    $link = @mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword);

...and again REPLACE with:

    $link = @mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword);
    mysql_set_charset("utf8",$link);

Re-import all feeds, and search with special characters should then work as expected...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by zlomennypez on Wed, 2012-03-07 12:44

Now there is a problem with chars, when i search for kočárek it shows results and there is ko?arek

Submitted by support on Wed, 2012-03-07 12:51

Hi,

Ah OK, as a next step, it would be worth making sure that the products table is definitely utf8 and the correct collation. To do this, create a file called dbcollate.php in the top level folder of your Price Tapestry installation:

<?php
  set_time_limit
(0);
  require(
"includes/common.php"):
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products` CHARACTER SET utf8 COLLATE utf8_general_ci";
  
database_queryModify($sql,$result);
  print 
"Done";
?>

Browse to the file, and after "Done" is displayed re-import all feeds to apply the changes...

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by zlomennypez on Wed, 2012-03-07 17:39

Is available to change chars? ÄŤ for č or Ä›for ě in any file? I think thats is the problem. Before I changed the database.php it was ok.

Thanx for help.

Submitted by support on Wed, 2012-03-07 18:55

Hi Pavel,

Yes, this can be done, so it makes the search insensitive to whether your users enter special characters or not. I have received your email and will check your feed on my server and once I have worked out the search I will reply with an optional mod to convert extended characters to non-extended equivalent characters...

Cheers,
David.
--
PriceTapestry.com