{"id":780,"date":"2020-03-21T08:27:34","date_gmt":"2020-03-21T08:27:34","guid":{"rendered":"http:\/\/angelwings.net\/blog\/?p=780"},"modified":"2020-03-21T08:27:34","modified_gmt":"2020-03-21T08:27:34","slug":"prestashop-search-does-not-index-product-reference-numbers-properly","status":"publish","type":"post","link":"https:\/\/angelwings.net\/blog\/prestashop-search-does-not-index-product-reference-numbers-properly\/","title":{"rendered":"Prestashop: Search does not index product reference numbers properly"},"content":{"rendered":"<p>The native Search.php class would only index characters that appear before &#8216;-&#8216; hyphen or other punctuations, so if your products have reference numbers for example like &#8216;ABC-123&#8217;, only &#8216;ABC&#8217; is indexed for the product. The workaround is to edit the Search.php class and use it as override.<\/p>\n<p>use class Search extends SearchCore {} as a wrapper for public static function sanitize ()<\/p>\n<p>Find $indexation and remove the hyphen from preg_replace like so:<\/p>\n<p>if ($indexation) {<br \/>\n$string = preg_replace(&#8216;\/[._]+\/&#8217;, &#8216; &#8216;, $string);<br \/>\n}<\/p>\n<p>Reindex the products completely after upload.<\/p>\n<p>For additional reference, the database tables to cross check are ps_search_word and ps_search_index<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The native Search.php class would only index characters that appear before &#8216;-&#8216; hyphen or other punctuations, so if your products have reference numbers for example like &#8216;ABC-123&#8217;, only &#8216;ABC&#8217; is indexed for the product. The workaround is to edit the Search.php class and use it as override. use class Search extends SearchCore {} as a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[103,105],"class_list":["post-780","post","type-post","status-publish","format-standard","hentry","category-ecommerce","tag-prestashop","tag-prestashop-1-6"],"_links":{"self":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/comments?post=780"}],"version-history":[{"count":0,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/posts\/780\/revisions"}],"wp:attachment":[{"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/media?parent=780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/categories?post=780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/angelwings.net\/blog\/wp-json\/wp\/v2\/tags?post=780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}