From 99e442152ce11c81dd42c559b8cb09c82177ab52 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Fri, 22 Apr 2011 11:40:45 +0200 Subject: [PATCH] Do not search on single letter strings. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- include/ufbuilder.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/ufbuilder.inc.php b/include/ufbuilder.inc.php index 564879a..4df4c63 100644 --- a/include/ufbuilder.inc.php +++ b/include/ufbuilder.inc.php @@ -718,7 +718,12 @@ class UFBF_Quick extends UFB_Field /** Name */ $s = preg_replace('!\d+!', ' ', $s); - $strings = preg_split("![^a-zA-Z%]+!",$s, -1, PREG_SPLIT_NO_EMPTY); + $strings = preg_split("![^a-zA-Z%]+!", $s, -1, PREG_SPLIT_NO_EMPTY); + foreach ($strings as $key => $string) { + if (strlen($string) < 2) { + unset($strings[$key]); + } + } if (count($strings) > 5) { Platal::page()->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte"); $strings = array_slice($strings, 0, 5); -- 2.1.4