Fork me on GitHub
Subscribe 1

Ticket #1052 (open enhancement)

Changes for search_idx.php

  • Created: 2015-10-31 09:49:07
  • Reported by: Visman
  • Assigned to: None
  • Milestone: None
  • Component: search
  • Priority: normal

1. Doesn't correspond to the description

	// Replace multiple whitespace or dashes
	$text = preg_replace('%(\s){2,}%u', '\1', $text);

Need

	// Replace multiple whitespace or dashes
	$text = preg_replace('%([\s-])\1{1,}%u', '\1', $text);

or

	// Replace multiple whitespace
	$text = preg_replace('%\s{2,}%u', ' ', $text);

2. It is necessary to clean conjoint words with bb-codes. Example: word "естьhttp" for post

...есть[url=http://...

In strip_bbcode function

			'%\[img=([^\]]*+)\]([^[]*+)\[/img\]%'									=>	'$2 $1',	// Keep the url and description
			'%\[(url|email)=([^\]]*+)\]([^[]*+(?:(?!\[/\1\])\[[^[]*+)*)\[/\1\]%'	=>	'$2 $3',	// Keep the url and text
			'%\[(img|url|email)\]([^[]*+(?:(?!\[/\1\])\[[^[]*+)*)\[/\1\]%'			=>	'$2',		// Keep the url

replace

			'%\[img=([^\]]*+)\]([^[]*+)\[/img\]%'									=>	' $2 $1 ',	// Keep the url and description
			'%\[(url|email)=([^\]]*+)\]([^[]*+(?:(?!\[/\1\])\[[^[]*+)*)\[/\1\]%'	=>	' $2 $3 ',	// Keep the url and text
			'%\[(img|url|email)\]([^[]*+(?:(?!\[/\1\])\[[^[]*+)*)\[/\1\]%'			=>	' $2 ',		// Keep the url

3. Addition for split_words() function:
after

	// Remove BBCode
	$text = preg_replace('%\[/?(b|u|s|ins|del|em|i|h|colou?r|quote|code|img|url|email|list|topic|post|forum|user)(?:\=[^\]]*)?\]%', ' ', $text);

add

	$text = str_replace(array('`', '’', 'ё'), array('\'', '\'', 'е'), $text); // russian letter "ё" replaced by russian letter "е" and apostrophe/closing single quotation mark replaced by single quotation mark

History

Visman 2015-10-31 11:14:30

  • Description changed. (Diff)