Code Duplication    Length = 18-18 lines in 2 locations

includes/search/SearchMySQL.php 1 location

@@ 133-150 (lines=18) @@
130
		return " MATCH($field) AGAINST($searchon IN BOOLEAN MODE) ";
131
	}
132
133
	function regexTerm( $string, $wildcard ) {
134
		global $wgContLang;
135
136
		$regex = preg_quote( $string, '/' );
137
		if ( $wgContLang->hasWordBreaks() ) {
138
			if ( $wildcard ) {
139
				// Don't cut off the final bit!
140
				$regex = "\b$regex";
141
			} else {
142
				$regex = "\b$regex\b";
143
			}
144
		} else {
145
			// For Chinese, words may legitimately abut other words in the text literal.
146
			// Don't add \b boundary checks... note this could cause false positives
147
			// for latin chars.
148
		}
149
		return $regex;
150
	}
151
152
	public static function legalSearchChars() {
153
		return "\"*" . parent::legalSearchChars();

includes/search/SearchSqlite.php 1 location

@@ 125-142 (lines=18) @@
122
		return " $field MATCH $searchon ";
123
	}
124
125
	function regexTerm( $string, $wildcard ) {
126
		global $wgContLang;
127
128
		$regex = preg_quote( $string, '/' );
129
		if ( $wgContLang->hasWordBreaks() ) {
130
			if ( $wildcard ) {
131
				// Don't cut off the final bit!
132
				$regex = "\b$regex";
133
			} else {
134
				$regex = "\b$regex\b";
135
			}
136
		} else {
137
			// For Chinese, words may legitimately abut other words in the text literal.
138
			// Don't add \b boundary checks... note this could cause false positives
139
			// for latin chars.
140
		}
141
		return $regex;
142
	}
143
144
	public static function legalSearchChars() {
145
		return "\"*" . parent::legalSearchChars();