blaszta Posted July 27, 2009 Share Posted July 27, 2009 I'm quite puzzle how the search features works, especially for more than one word keywords. Sometimes it give the correct result, sometimes not.I set up a shop, located in here: http://shayna-alexis.com/shop/. Every time I search for "mud pie" (which is one of the brand), it give wrong result. I already make sure at least one "mud pie" word written in description and/or short description.Can somebody explain to me the syntax PrestaShop use to query the database?Should it be something like this: SELECT * FROM `ps_product_lang` WHERE `description` LIKE '%mud pie%' If I want to change how the search feature works, can you give me the name of the file and which function should I change?Thank you, any help will be appreciated..Jay Link to comment Share on other sites More sharing options...
ruilong Posted July 27, 2009 Share Posted July 27, 2009 Hava a look in classes search.php MATCH (pl.`name`, `description`, `description_short`, `ean13`, `reference`) AGAINST (\''.$expr.'\' IN BOOLEAN MODE)'; Link to comment Share on other sites More sharing options...
blaszta Posted July 27, 2009 Author Share Posted July 27, 2009 Thanks ruilong for the reply.I'm currently opening file /search.php in my text editor, but I can't find the code you mention. Which line number that the code you mention should be?I attach the search.php file for your convenience. search.php Link to comment Share on other sites More sharing options...
blaszta Posted July 27, 2009 Author Share Posted July 27, 2009 Apparently I'm opening the wrong file. The correct file should be /classes/Search.phpThe default search function split the keywords (same as OR) I assume. And it use '%' sign, so it should show up the correct result right? Why the example in my first post doesn't work? Link to comment Share on other sites More sharing options...
blaszta Posted July 28, 2009 Author Share Posted July 28, 2009 Nobody has the same problem with me? Maybe someone can give me some shed of light how the search feature works and how to fix my issue?Any help will be appreciated.Jay Link to comment Share on other sites More sharing options...
blaszta Posted July 28, 2009 Author Share Posted July 28, 2009 After reading MySQL manual and do some Googling, I found out it related to Full Text Search (FTS) feature which only works for at least 4 character (ft_min_word_len variable). Since I'm in shared hosting, I can't change this. So I disable the FTS feature, and the search feature works as I intended.Anybody have better idea than disable the FTS? Link to comment Share on other sites More sharing options...
Tony Chan Posted August 5, 2009 Share Posted August 5, 2009 blaszta so can you show me how can i disable full text search, i use bluehost Link to comment Share on other sites More sharing options...
blaszta Posted August 5, 2009 Author Share Posted August 5, 2009 If you're using Prestashop 1.1 (my version when I started this thread), the solution quite easy.open file /classes/Search.php, and there;s 2 lines you need to modified: line 26 & 64. On these 2 lines the code is: case 'MySQL' change to: case '-MySQL' this trick will make prestashop thinks you didn't use MySQL and hence doesn't use FTS feature (only use standard search query).In prestashop 1.2 (I just upgraded last week) the search feature has been revamped. It doesn't use FTS (CMIIW), and in the table ps_configuration there is configuration of min word length (PS_SEARCH_MINWORDLEN) which is by default is 3. But the problem is, it works in the admin section for 3 letters words but doesn't work on the front end.What I also found strange, the max word length is hard coded in Search.php: define('PS_SEARCH_MAX_WORD_LENGTH', 15); also the naming convention of the constant slightly different (notice the '_' sign).I'm not sure if it's a bug in 1.2So far I can't make the front end works for searching 3 letter words on 1.2 Link to comment Share on other sites More sharing options...
Zippout Posted February 11, 2010 Share Posted February 11, 2010 If you're using Prestashop 1.1 (my version when I started this thread), the solution quite easy.open file /classes/Search.php, and there;s 2 lines you need to modified: line 26 & 64. On these 2 lines the code is: case 'MySQL' change to: case '-MySQL' this trick will make prestashop thinks you didn't use MySQL and hence doesn't use FTS feature (only use standard search query).In prestashop 1.2 (I just upgraded last week) the search feature has been revamped. It doesn't use FTS (CMIIW), and in the table ps_configuration there is configuration of min word length (PS_SEARCH_MINWORDLEN) which is by default is 3. But the problem is, it works in the admin section for 3 letters words but doesn't work on the front end.What I also found strange, the max word length is hard coded in Search.php: define('PS_SEARCH_MAX_WORD_LENGTH', 15); also the naming convention of the constant slightly different (notice the '_' sign).I'm not sure if it's a bug in 1.2So far I can't make the front end works for searching 3 letter words on 1.2 Many thanks Blaszta !! it works really well now on 1105 !!!Good job Link to comment Share on other sites More sharing options...
GG.Pepe Posted June 21, 2010 Share Posted June 21, 2010 of min word length (PS_SEARCH_MINWORDLEN) which is by default is 3 but if i want 2 what i must do? i need this asap Link to comment Share on other sites More sharing options...
Recommended Posts