Project

General

Profile

« Previous | Next » 

Revision 445

Added by Matthias about 17 years ago

Optimized search and highlighting funktions

View differences:

search.php
61 61
		$string_entities = umlauts_to_entities($string);
62 62
		// and do some convertion to both
63 63
		require(WB_PATH.'/search/search_convert.php');
64
		if(strcmp(DEFAULT_CHARSET, "iso-8859-1") == 0) {
65
			$string=strtr($string,$string_conv_iso88591);
66
			$string_entities=strtr($string_entities,$string_entities_conv_iso88591);
67
		}
64
		$string = strtr($string,$string_conv_all);
65
		$string_entities = strtr($string_entities,$string_entities_conv_all);
68 66
		$search_string = $string_entities;
69 67
	} else {
70 68
		$string = '';
......
185 183
				
186 184
				//Add search string for highlighting
187 185
				if ($match!='exact') {
188
					$sorted=array_merge($string,$string_entities);
189
					sort($sorted);
190
					$sstring = implode(" ", $sorted);
186
					$sstring = implode(" ", $string);
191 187
					$link = $link."?searchresult=1&sstring=".urlencode($sstring);
192 188
				}
193 189
				else {
194
					$sstring = strtr($string[0], " ", "_")." ".strtr($string_entities[0], " ","_");
190
					$sstring = strtr($string[0], " ", "_");
195 191
					$link = $link."?searchresult=2&sstring=".urlencode($sstring);
196 192
				}
197 193
				
......
279 275
										
280 276
										//Add search string for highlighting
281 277
										if ($match!='exact') {
282
											$sorted=array_merge($string,$string_entities);
283
											sort($sorted);
284
											$sstring = implode(" ", $sorted);
278
											$sstring = implode(" ", $string);
285 279
											$link = $link."?searchresult=1&sstring=".urlencode($sstring);
286 280
										}
287 281
										else {
288
											$sstring = strtr($string[0], " ", "_")." ".strtr($string_entities[0], " ","_");
282
											$sstring = strtr($string[0], " ", "_");
289 283
											$link = $link."?searchresult=2&sstring=".urlencode($sstring);
290 284
										}
291 285
										

Also available in: Unified diff