Prestashop: Search does not index product reference numbers properly

The native Search.php class would only index characters that appear before ‘-‘ hyphen or other punctuations, so if your products have reference numbers for example like ‘ABC-123’, only ‘ABC’ 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 wrapper for public static function sanitize ()

Find $indexation and remove the hyphen from preg_replace like so:

if ($indexation) {
$string = preg_replace(‘/[._]+/’, ‘ ‘, $string);
}

Reindex the products completely after upload.

For additional reference, the database tables to cross check are ps_search_word and ps_search_index

This entry was posted in ecommerce and tagged , . Bookmark the permalink.