Grif Posted October 30, 2009 Share Posted October 30, 2009 I have noticed that Presta doesn't search in combinations for reference, so i have modified Search class to search in reference field in combinations (only in Front Office for now - version 1.2.5). You need to overwrite Search.php in classes folder.Be sure you backup your files before overwrite them! Search.phpFetching info... Link to comment Share on other sites More sharing options...
ukbaz Posted November 10, 2009 Share Posted November 10, 2009 Hi Have tried this in 1.2.4 and doesn't work :-( Do I need to make many changes to get this working on that version of Prestashop? Thanks, Baz Link to comment Share on other sites More sharing options...
Grif Posted November 11, 2009 Author Share Posted November 11, 2009 I didn't tested but this should work for 1.2.4 either. The results are displayed only if there is no record found in product table. Link to comment Share on other sites More sharing options...
Hardik Posted November 17, 2009 Share Posted November 17, 2009 prestashop not searching combination names though very high weight given in search preferences any ideas... prestaahop v1.2.5 Link to comment Share on other sites More sharing options...
joshsherm Posted November 19, 2009 Share Posted November 19, 2009 my prestashop (ver 1.25) doesn't even search for the products main reference number!!! Link to comment Share on other sites More sharing options...
Hardik Posted November 20, 2009 Share Posted November 20, 2009 i sorted out my issue... the problem was that as per one forum post i needed to order my attributes and attribute groups... so i had 001. 002. 003. in all my attributes... now when prestashop was indexing for the search, it was indexing 001.Atribute name instead of only the "attribute name". I had to sit and add a space to all my attributes and regenerate the index and it works fine now... kindly note, this problem occured because if prestashop has indexed "001.attribute name" and one searches for "attribute" it doesnt seem to be picking up parts of words... so only a search for "name" or "001.attribute" would lead to a match.hope this helps... Link to comment Share on other sites More sharing options...
Grif Posted November 21, 2009 Author Share Posted November 21, 2009 Quote i sorted out my issue... the problem was that as per one forum post i needed to order my attributes and attribute groups... so i had 001. 002. 003. in all my attributes... now when prestashop was indexing for the search, it was indexing 001.Atribute name instead of only the "attribute name". I had to sit and add a space to all my attributes and regenerate the index and it works fine now... kindly note, this problem occured because if prestashop has indexed "001.attribute name" and one searches for "attribute" it doesnt seem to be picking up parts of words... so only a search for "name" or "001.attribute" would lead to a match.hope this helps... Prestashop searches based on minimum word length. If you set it to 2 than it search for first 2 characters in words from search_words table.If you want to search inside words you have to change in find function from search class adding a % character in select query where appears like operator. Link to comment Share on other sites More sharing options...
joshsherm Posted November 21, 2009 Share Posted November 21, 2009 could ylou please help me add a find function to search the reference tables Link to comment Share on other sites More sharing options...
Grif Posted November 21, 2009 Author Share Posted November 21, 2009 Quote could ylou please help me add a find function to search the reference tables The find function is in Search class (classes/Search.php). It searches the words indexed by prestashop (which includes the references for products but only those without combinations of attributes).Try rebuilt the entire index in back ofice. Link to comment Share on other sites More sharing options...
joshsherm Posted November 21, 2009 Share Posted November 21, 2009 how do i rebuild the index? don't i need to modify search.php? Link to comment Share on other sites More sharing options...
Grif Posted November 21, 2009 Author Share Posted November 21, 2009 In Back Office/Preferences/Search -> Re-build entire index. Link to comment Share on other sites More sharing options...
joshsherm Posted November 21, 2009 Share Posted November 21, 2009 just tried it.... didn't seem to change anything.. store still doesn't search for reference Link to comment Share on other sites More sharing options...
Benik Posted April 8, 2013 Share Posted April 8, 2013 For searching inside of word you need to add % character in SELECT SQL function, somewhere on line 190. See the difference from this code (original) $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)).'%\'' ); And this is edited code that allows you to search inside of indexed word not only for first characters $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)).'%\'' ); This helped me Quote You can just use wildcards in the predicate (after IF, WHERE or ON):@mainstring LIKE '%' + @substring + '%' or in this specific case ' ' + @mainstring + ' ' LIKE '% ME[., ]%' (Put the spaces in the quoted string if you're looking for the whole word, or leave them out if ME can be part of a bigger word). 1 Link to comment Share on other sites More sharing options...
Recommended Posts