Mark Wu Posted March 25, 2011 Share Posted March 25, 2011 Hello,Today I find a big problem with searching function in Front office, i read all the topics i can find in the forum, but no lucky.I try to search by: tag, reference number, entire title name, non working!!!some friend suggest me to rebuild the entier index, but that is worse!! i can not search any results which is can be found before.At same time, back office search function is better, it is able to find out all the items at back office by input any keywords.Anyone could help? or How can i move the back office search function to front office?Thanks! Link to comment Share on other sites More sharing options...
Mark Wu Posted March 26, 2011 Author Share Posted March 26, 2011 It is really a big problem of the search function, compare with Zen-cart, prestashop is terrible. Link to comment Share on other sites More sharing options...
jtlswanson Posted June 14, 2011 Share Posted June 14, 2011 I just upgraded to 1.4.2.5. I am now having searching issues similar to above mentioned. In the BO, if I do a search, it will find the products just fine, but doing the same keyword product search in the FO returns zilch results.I have tried re-indexing as well as nuking my products and re-importing, force compiling, different minimum word length, allowing and not-allowing friendly URLs. etc...Please, please, please any ideas, suggestions, help would be seriously appreciated!Thank you in advance for anyone's time and efforts!JTLS Link to comment Share on other sites More sharing options...
shokinro Posted June 15, 2011 Share Posted June 15, 2011 I also agree that the search function is not good in PrestaShop, just like the search function in this forum.Some time I have to Google to find a old topic in this forum. Link to comment Share on other sites More sharing options...
jtlswanson Posted June 15, 2011 Share Posted June 15, 2011 Hey Angora,Well, I think I should of mentioned that I have over 15,000 products :-)The searchfix.php file works but times-out on my end probably because I have so many products. Some of products are starting to show up in the search section now that were not available before. Can I change the max_execution_time to a higher number? or is there another way you might know?Thanks for your wisdom!JTLS Link to comment Share on other sites More sharing options...
jtlswanson Posted June 16, 2011 Share Posted June 16, 2011 Hey Angora,Yeah, I'm hosting with GoDaddy...need I say more? Do you think there is some sort of sql code I can run in the backend of the mysql database?Justin Link to comment Share on other sites More sharing options...
Shannon Cole Posted June 17, 2011 Share Posted June 17, 2011 Try this. Copy/paste the following into a file and place it on your server in the pathadmin/searchfix.phpthen visit its URL in your browser ( http://myshop/myadminpath/searchfix.php ).Afterward, (remove the utility script and) check whether the front office search now behaves properly <?php @ini_set('display_errors', 'on'); require_once(dirname(__FILE__).'/../config/config.inc.php'); require_once(dirname(__FILE__).'/init.php'); ini_set('max_execution_time', 7200); Search::indexation('true'); echo 'success -- search index has been rebuilt'; ?> If the problem persists, toward troubleshooting I would have some questions:What was your ps version prior to the upgrade?"front office keyword product search" means using tag(s) as the search query?If so, have you browsed the "tag" table using phpmyadmin to verify whether or not the table is empty (0 rows) ? I'm having a problem with the search index as well. It won't index the products. I've tried both the "Add missing products to index" and "Re-build entire index" and it doesn't change. It just keeps showing "Indexed products: 0 / 9011".I have also created the file above and ran it on my server and it said "success -- search index has been rebuilt" but still it shows 0 products indexed.Any more ideas?Is there a way to run a check on the database to make sure the data is not corrupted or if there might be an invalid character or something that could be causing the problem. I'm starting to think it might be something within the data on the database because I can't backup the database using the internal prestashop backup either. When I try and do a DB backup I get "An error occur while backing up. Unable to obtain the schema of "ps_product_sale" Link to comment Share on other sites More sharing options...
scumdk Posted July 23, 2011 Share Posted July 23, 2011 I have the exact same problem as you guys with v1.4.3. I had the problem with 1.3.7 as well. We have over 20.000 products in our store and we are going to depend on people being able to search, so any inputs are welcome. Hope we can fix this together. Link to comment Share on other sites More sharing options...
scumdk Posted July 23, 2011 Share Posted July 23, 2011 Here is what i have tried: - reindexing the search. - removing all files from the tables: ps_search_index and ps_search_word and reindexing again. - indexing a few products and then try to search, same result. So frustrating :-/ Link to comment Share on other sites More sharing options...
scumdk Posted July 25, 2011 Share Posted July 25, 2011 Hey guys. I found a solution to my search problem and it seems its the module search thats going wrong. I removed the module and installed a topmenu module with integrated search and now all my searches works flawless. Try it out and get the module here: http://www.legeserver.dk/prestashop/blocktopmenu_1_3.tar Enjoy Link to comment Share on other sites More sharing options...
Gipielle Posted July 26, 2011 Share Posted July 26, 2011 We have the same problem with 10.000 products, now we try your solution scumdk and hope it will go ! Link to comment Share on other sites More sharing options...
XJR100 Posted August 8, 2011 Share Posted August 8, 2011 I have almost same problem - indexing cron job does not add all words from product description. I've imported product description with htm tables inside with phpmyadmin, rebuilded index and only part of description went into ps_search_words table. Reindex does not help. The only help the following: 1) edit product in back office: just add space or enter and save (it's terrible to wait - after save PS removes product from search index and add it again) - takes long time or 2) get descriptin field to notepad, manualy edit it (mainly changing layout - spaces, enter, tabs) and paste it back to ps_product_land and set index in ps_product table = 0 and then "add missing products" to index Then all needed words appear in ps_search_words and after it I can serch all words what are in description field. I expect, that indexing routine does not accept correctly data from field description from ps_product_lang if there is html code (in my case it was table). A bit confused, how I can fix those 13.000 products that all their description will be indexed Forgot to mention: I use 1.4.3 version Link to comment Share on other sites More sharing options...
Lotus Ong Posted August 9, 2011 Share Posted August 9, 2011 I have the similar problem but try the following steps to get back the search functions. You might want to try out the following steps: 1. Disable the Friendly URL from Preferences SEO & URLs -> URsL Setup 2. Regenerate the .htaccess file without enable the Friendly URL from Tools -> Generator 3. Rebuild the full index from Preferences -> Search. The only drawback is your website don't have the Friendly URL. Link to comment Share on other sites More sharing options...
summer Posted August 23, 2011 Share Posted August 23, 2011 Thank god! Many other people having similar problem like mine. Is there a good solution for this? Link to comment Share on other sites More sharing options...
shehzadrah Posted October 18, 2011 Share Posted October 18, 2011 any luck in solving this problem??? Link to comment Share on other sites More sharing options...
Mike Kranzler Posted October 18, 2011 Share Posted October 18, 2011 Hi shezedrah, Can you give me any information about your installation, such as version number, theme and URL? -Mike Link to comment Share on other sites More sharing options...
kitchenone Posted October 19, 2011 Share Posted October 19, 2011 Does anyone have experience with an alternative prestashop-module for searching? Maybe a little more "intelligent" function, also with regard to spelling issues and displaying categories correctly. Link to comment Share on other sites More sharing options...
Darkie Posted November 16, 2011 Share Posted November 16, 2011 Rebuilding my entire index fixed my search issue : Preferences -> Search I upgraded from 1.2.5 - 1.4.5.1 Link to comment Share on other sites More sharing options...
thienxu Posted June 17, 2012 Share Posted June 17, 2012 My solution is replacing code of FO search by BO search. FO search uses search_word and search_index tables but BO search uses SQL query directly. Find these code: foreach ($words AS $key => $word) if (!empty($word) AND strlen($word) >= (int)Configuration::get('PS_SEARCH_MINWORDLEN')) { $word = str_replace('%', '\\%', $word); $word = str_replace('_', '\\_', $word); $intersectArray[] = 'SELECT id_product FROM '._DB_PREFIX_.'search_word sw LEFT JOIN '._DB_PREFIX_.'search_index si ON sw.id_word = si.id_word WHERE sw.id_lang = '.(int)$id_lang.' AND sw.word LIKE '.($word[0] == '-' ? ' \''.pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)).'%\'' : '\''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\'' ); if ($word[0] != '-') $scoreArray[] = 'sw.word LIKE \''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\''; } else unset($words[$key]); replace by: $intersectArray[] = 'SELECT distinct p.id_product FROM ps_product p LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$id_lang.') WHERE pl.name LIKE \'%'.pSQL($expr).'%\''; My website: www.sachdinhle.com 1 Link to comment Share on other sites More sharing options...
thienxu Posted June 17, 2012 Share Posted June 17, 2012 forgot name of file to edit code: /classes/search.php Link to comment Share on other sites More sharing options...
xrichardt Posted July 24, 2012 Share Posted July 24, 2012 Solution: upgrade to latest Prestashop (a lot has been improved!), or, if you cannot upgrade, update only indexation functions Search in my Prestashop 1.4.2.5. broke down recently (slow, inclomplete, problems with accented characters). I was searching for a solution, noticed that ps_search_index has incomplete results etc. Next, I noticed a lot has been improved in latest version of Prestahop regarding search (see changelogs). In my case, I couldn't upgrade (my shop is heavily customised), the solution for me was to update indexation functions only, it works great since – what you have to do is to download the latest Prestashop and replace current and add a couple of new functions: Classes/Search.php replace public static function indexation add protected static function getProductsToIndex Classes/Tools.php add public static function replaceAccentedChars Link to comment Share on other sites More sharing options...
mante80 Posted January 5, 2013 Share Posted January 5, 2013 My solution is replacing code of FO search by BO search. FO search uses search_word and search_index tables but BO search uses SQL query directly. Find these code: foreach ($words AS $key => $word) if (!empty($word) AND strlen($word) >= (int)Configuration::get('PS_SEARCH_MINWORDLEN')) { $word = str_replace('%', '\\%', $word); $word = str_replace('_', '\\_', $word); $intersectArray[] = 'SELECT id_product FROM '._DB_PREFIX_.'search_word sw LEFT JOIN '._DB_PREFIX_.'search_index si ON sw.id_word = si.id_word WHERE sw.id_lang = '.(int)$id_lang.' AND sw.word LIKE '.($word[0] == '-' ? ' \''.pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)).'%\'' : '\''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\'' ); if ($word[0] != '-') $scoreArray[] = 'sw.word LIKE \''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\''; } else unset($words[$key]); replace by: $intersectArray[] = 'SELECT distinct p.id_product FROM ps_product p LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$id_lang.') WHERE pl.name LIKE \'%'.pSQL($expr).'%\''; My website: www.sachdinhle.com Solved thanks to your post! Thank you Link to comment Share on other sites More sharing options...
Publisher Posted January 11, 2013 Share Posted January 11, 2013 My solution is replacing code of FO search by BO search. FO search uses search_word and search_index tables but BO search uses SQL query directly. Find these code: foreach ($words AS $key => $word) if (!empty($word) AND strlen($word) >= (int)Configuration::get('PS_SEARCH_MINWORDLEN')) { $word = str_replace('%', '\\%', $word); $word = str_replace('_', '\\_', $word); $intersectArray[] = 'SELECT id_product FROM '._DB_PREFIX_.'search_word sw LEFT JOIN '._DB_PREFIX_.'search_index si ON sw.id_word = si.id_word WHERE sw.id_lang = '.(int)$id_lang.' AND sw.word LIKE '.($word[0] == '-' ? ' \''.pSQL(Tools::substr($word, 1, PS_SEARCH_MAX_WORD_LENGTH)).'%\'' : '\''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\'' ); if ($word[0] != '-') $scoreArray[] = 'sw.word LIKE \''.pSQL(Tools::substr($word, 0, PS_SEARCH_MAX_WORD_LENGTH)).'%\''; } else unset($words[$key]); replace by: $intersectArray[] = 'SELECT distinct p.id_product FROM ps_product p LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$id_lang.') WHERE pl.name LIKE \'%'.pSQL($expr).'%\''; My website: www.sachdinhle.com Does not work with reference numbers. How we can fix that? Solution: upgrade to latest Prestashop (a lot has been improved!), or, if you cannot upgrade, update only indexation functions Search in my Prestashop 1.4.2.5. broke down recently (slow, inclomplete, problems with accented characters). I was searching for a solution, noticed that ps_search_index has incomplete results etc. Next, I noticed a lot has been improved in latest version of Prestahop regarding search (see changelogs). In my case, I couldn't upgrade (my shop is heavily customised), the solution for me was to update indexation functions only, it works great since – what you have to do is to download the latest Prestashop and replace current and add a couple of new functions: Classes/Search.php replace public static function indexation add protected static function getProductsToIndex Classes/Tools.php add public static function replaceAccentedChars Does not work for me, or can you explain this solution more in detail? Thanks a lot. Link to comment Share on other sites More sharing options...
Publisher Posted January 16, 2013 Share Posted January 16, 2013 I could fix the problem. Our hoster upgraded PHP 5.2 to PHP 5.3 . We could downgrade it back to PHP 5.2 . Search Engine is working now perfectly since before the PHP upgrade. Link to comment Share on other sites More sharing options...
Recommended Posts