From 350367047811945355d1abd8eeb09c7e09b50f92 Mon Sep 17 00:00:00 2001 From: ChristopheBoucaut Date: Tue, 23 Jul 2013 09:36:08 +0200 Subject: [PATCH] Update Search.php $string = preg_replace('/[._-]+/', '', $string); Ex : Product's name : Saint-leon Search : leon => 0 result ------------------------------------------------------ $string = preg_replace('/[._-]+/', ' ', $string); Ex : Product's name : Saint-leon Search : leon => 1 result ------------------------------------------------------- I think that thus the search is more relevant --- classes/Search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Search.php b/classes/Search.php index 1ab992005..54e600011 100644 --- a/classes/Search.php +++ b/classes/Search.php @@ -102,11 +102,11 @@ class SearchCore $string = preg_replace('/['.PREG_CLASS_SEARCH_EXCLUDE.']+/u', ' ', $string); if ($indexation) - $string = preg_replace('/[._-]+/', '', $string); + $string = preg_replace('/[._-]+/', ' ', $string); else { $string = preg_replace('/[._]+/', '', $string); - $string = ltrim(preg_replace('/([^ ])-/', '$1', ' '.$string)); + $string = ltrim(preg_replace('/([^ ])-/', '$1 ', ' '.$string)); $string = preg_replace('/[._]+/', '', $string); $string = preg_replace('/[^\s]-+/', '', $string); }