From 7fae203a8331e3baf7a4e285851ae84486159227 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 17 May 2024 12:28:31 +0200 Subject: [PATCH] fixes #2161 in search, do not consider dot character alone as a splitter --- include/functions_search.inc.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php index 73409ce1f..92a47f255 100644 --- a/include/functions_search.inc.php +++ b/include/functions_search.inc.php @@ -1705,12 +1705,14 @@ function split_allwords($raw_allwords) { $words = null; - $raw_allwords = trim($raw_allwords); + // we specify the list of characters to trim, to add the ".". We don't want to split words + // on "." but on ". ", and we have to deal with trailing dots. + $raw_allwords = trim($raw_allwords, " \n\r\t\v\x00."); if (!preg_match('/^\s*$/', $raw_allwords)) { - $drop_char_match = array(';','&','(',')','<','>','`','\'','"','|',',','@','?','%','.','[',']','{','}',':','\\','/','=','\'','!','*'); - $drop_char_replace = array(' ',' ',' ',' ',' ',' ', '', '', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','' , ' ',' ',' ', ' ',' '); + $drop_char_match = array(';','&','(',')','<','>','`','\'','"','|',',','@','?','%','. ','[',']','{','}',':','\\','/','=','\'','!','*'); + $drop_char_replace = array(' ',' ',' ',' ',' ',' ', '', '', ' ',' ',' ',' ',' ',' ',' ' ,' ',' ',' ',' ',' ','' , ' ',' ',' ', ' ',' '); // Split words $words = array_unique(