[Mapbender-commits] r10202 - trunk/mapbender/http/geoportal

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Aug 8 01:45:00 PDT 2019


Author: armin11
Date: 2019-08-08 01:45:00 -0700 (Thu, 08 Aug 2019)
New Revision: 10202

Modified:
   trunk/mapbender/http/geoportal/mod_getCatalogueKeywordSuggestion.php
Log:
Fix for https://git.osgeo.org/gitea/armin11/GeoPortal.rlp/issues/67

Modified: trunk/mapbender/http/geoportal/mod_getCatalogueKeywordSuggestion.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_getCatalogueKeywordSuggestion.php	2019-08-08 07:07:39 UTC (rev 10201)
+++ trunk/mapbender/http/geoportal/mod_getCatalogueKeywordSuggestion.php	2019-08-08 08:45:00 UTC (rev 10202)
@@ -47,7 +47,7 @@
 
 $normSearch = str_replace('ß', 'SS', str_replace('Ü', 'UE', str_replace('Ä', 'AE', strtoupper(str_replace('Ö', 'OE', mb_strtoupper($searchText))))));
 
-$sql = "SELECT keyword FROM keyword_search_view WHERE keyword_upper LIKE $1 ORDER BY keyword LIMIT $2";
+$sql = "SELECT keyword, keyword_upper FROM keyword_search_view WHERE keyword_upper LIKE $1 ORDER BY keyword LIMIT $2";
 $t = array('s', 'i');
 //$e = new mb_exception($normSearch);
 //$v = array($searchText, $normSearch."%", $maxResults);
@@ -61,11 +61,12 @@
 while($row = db_fetch_array($res)){
 	$resultList[$i]['keyword'] = trim($row['keyword']);
 	//find pos of searchText in keyword - lowercase
-	$posOfString = strpos(mb_strtolower($row['keyword']), mb_strtolower($searchText));
-
-	$lengthOfSearchtext = count($searchText);
+	$posOfString = strpos(mb_strtolower($row['keyword_upper']), mb_strtolower($searchText));
+	$lengthOfSearchtext = strlen($searchText);
+//$e = new mb_exception($lengthOfSearchtext);
+//$e = new mb_exception(gettype($searchText));	
 	$lengthOfKeyword = count($row['keyword']);
-	$resultList[$i]['keywordHigh'] = trim(substr($row['keyword'], 0, $posOfString)."<b>".substr($row['keyword'], $posOfString, $lengthOfSearchtext+1)."</b>".substr($row['keyword'], ($posOfString + $lengthOfSearchtext + 1)));
+	$resultList[$i]['keywordHigh'] = trim(substr($row['keyword'], 0, $posOfString)."<b>".substr($row['keyword'], $posOfString, $lengthOfSearchtext)."</b>".substr($row['keyword'], ($posOfString + $lengthOfSearchtext)));
 	//$resultList[$i]['keywordHigh'] = str_replace($searchText, "<b>".$searchText."</b>", $row['keyword']);
 	$i++;
 }



More information about the Mapbender_commits mailing list