- Patch #493770 by Garrett Albright, tobiasb: search incorrectly splits some katakana words.
parent
712929ea6a
commit
89028a43bb
|
@ -42,11 +42,11 @@ define('PREG_CLASS_SEARCH_EXCLUDE',
|
||||||
'\x{2108}\x{2109}\x{2114}\x{2116}-\x{2118}\x{211e}-\x{2123}\x{2125}\x{2127}' .
|
'\x{2108}\x{2109}\x{2114}\x{2116}-\x{2118}\x{211e}-\x{2123}\x{2125}\x{2127}' .
|
||||||
'\x{2129}\x{212e}\x{2132}\x{213a}\x{213b}\x{2140}-\x{2144}\x{214a}-\x{2b13}' .
|
'\x{2129}\x{212e}\x{2132}\x{213a}\x{213b}\x{2140}-\x{2144}\x{214a}-\x{2b13}' .
|
||||||
'\x{2ce5}-\x{2cff}\x{2d6f}\x{2e00}-\x{3005}\x{3007}-\x{303b}\x{303d}-\x{303f}' .
|
'\x{2ce5}-\x{2cff}\x{2d6f}\x{2e00}-\x{3005}\x{3007}-\x{303b}\x{303d}-\x{303f}' .
|
||||||
'\x{3099}-\x{309e}\x{30a0}\x{30fb}-\x{30fe}\x{3190}-\x{319f}\x{31c0}-\x{31cf}' .
|
'\x{3099}-\x{309e}\x{30a0}\x{30fb}\x{30fd}\x{30fe}\x{3190}-\x{319f}\x{31c0}-' .
|
||||||
'\x{3200}-\x{33ff}\x{4dc0}-\x{4dff}\x{a015}\x{a490}-\x{a716}\x{a802}\x{a806}' .
|
'\x{31cf}\x{3200}-\x{33ff}\x{4dc0}-\x{4dff}\x{a015}\x{a490}-\x{a716}\x{a802}' .
|
||||||
'\x{a80b}\x{a823}-\x{a82b}\x{d800}-\x{f8ff}\x{fb1e}\x{fb29}\x{fd3e}\x{fd3f}' .
|
'\x{a806}\x{a80b}\x{a823}-\x{a82b}\x{d800}-\x{f8ff}\x{fb1e}\x{fb29}\x{fd3e}' .
|
||||||
'\x{fdfc}-\x{fe6b}\x{feff}-\x{ff0f}\x{ff1a}-\x{ff20}\x{ff3b}-\x{ff40}\x{ff5b}-' .
|
'\x{fd3f}\x{fdfc}-\x{fe6b}\x{feff}-\x{ff0f}\x{ff1a}-\x{ff20}\x{ff3b}-\x{ff40}' .
|
||||||
'\x{ff65}\x{ff70}\x{ff9e}\x{ff9f}\x{ffe0}-\x{fffd}');
|
'\x{ff5b}-\x{ff65}\x{ff70}\x{ff9e}\x{ff9f}\x{ffe0}-\x{fffd}');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Matches all 'N' Unicode character classes (numbers)
|
* Matches all 'N' Unicode character classes (numbers)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
// Here we test with _test_ and _test2_ as the type.
|
// Here we test with _test_ and _test2_ as the type.
|
||||||
define('SEARCH_TYPE', '_test_');
|
define('SEARCH_TYPE', '_test_');
|
||||||
define('SEARCH_TYPE_2', '_test2_');
|
define('SEARCH_TYPE_2', '_test2_');
|
||||||
|
define('SEARCH_TYPE_JPN', '_test3_');
|
||||||
|
|
||||||
class SearchMatchTestCase extends DrupalWebTestCase {
|
class SearchMatchTestCase extends DrupalWebTestCase {
|
||||||
public static function getInfo() {
|
public static function getInfo() {
|
||||||
|
@ -42,6 +43,14 @@ class SearchMatchTestCase extends DrupalWebTestCase {
|
||||||
for ($i = 1; $i <= 5; ++$i) {
|
for ($i = 1; $i <= 5; ++$i) {
|
||||||
search_index($i + 7, SEARCH_TYPE_2, $this->getText2($i));
|
search_index($i + 7, SEARCH_TYPE_2, $this->getText2($i));
|
||||||
}
|
}
|
||||||
|
// No getText builder function for Japanese text; just a simple array.
|
||||||
|
foreach (array(
|
||||||
|
13 => '以呂波耳・ほへとち。リヌルヲ。',
|
||||||
|
14 => 'ドルーパルが大好きよ!',
|
||||||
|
15 => 'コーヒーとケーキ',
|
||||||
|
) as $i => $jpn) {
|
||||||
|
search_index($i, SEARCH_TYPE_JPN, $jpn);
|
||||||
|
}
|
||||||
search_update_totals();
|
search_update_totals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,6 +171,29 @@ class SearchMatchTestCase extends DrupalWebTestCase {
|
||||||
$this->_testQueryMatching($query, $set, $results);
|
$this->_testQueryMatching($query, $set, $results);
|
||||||
$this->_testQueryScores($query, $set, $results);
|
$this->_testQueryScores($query, $set, $results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These queries are run against the third index type, SEARCH_TYPE_JPN.
|
||||||
|
$queries = array(
|
||||||
|
// Simple AND queries.
|
||||||
|
'呂波耳' => array(13),
|
||||||
|
'以呂波耳' => array(13),
|
||||||
|
'ほへと ヌルヲ' => array(13),
|
||||||
|
'とちリ' => array(),
|
||||||
|
'ドルーパル' => array(14),
|
||||||
|
'パルが大' => array(14),
|
||||||
|
'コーヒー' => array(15),
|
||||||
|
'ヒーキ' => array(),
|
||||||
|
);
|
||||||
|
foreach ($queries as $query => $results) {
|
||||||
|
$result = db_select('search_index', 'i')
|
||||||
|
->extend('SearchQuery')
|
||||||
|
->searchExpression($query, SEARCH_TYPE_JPN)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$set = $result ? $result->fetchAll() : array();
|
||||||
|
$this->_testQueryMatching($query, $set, $results);
|
||||||
|
$this->_testQueryScores($query, $set, $results);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue