--- modules/search/search.test.orig	2009-06-12 01:39:38.000000000 -0700
+++ modules/search/search.test	2009-06-17 19:46:25.000000000 -0700
@@ -5,6 +5,7 @@
 // Here we test with _test_ and _test2_ as the type.
 define('SEARCH_TYPE', '_test_');
 define('SEARCH_TYPE_2', '_test2_');
+define('SEARCH_TYPE_JPN', '_test3_');
 
 class SearchMatchTestCase extends DrupalWebTestCase {
   public static function getInfo() {
@@ -42,6 +43,9 @@
     for ($i = 1; $i <= 5; ++$i) {
       search_index($i + 7, SEARCH_TYPE_2, $this->getText2($i));
     }
+    for ($i = 1; $i <= 6; ++$i) {
+      search_index($i + 12, SEARCH_TYPE_JPN, $this->getTextJpn($i));
+    }
     search_update_totals();
   }
 
@@ -76,6 +80,23 @@
     $words = explode(' ', "Dear King Philip came over from Germany swimming.");
     return implode(' ', array_slice($words, $n - 1, $n));
   }
+  
+  /**
+   * _test3_: Helper method for generating sinppets of Japanese content.
+   *
+   * Generated items to test against:
+   *  13 以呂波
+   *  14 呂波耳 ほ
+   *  15 波耳 ほへとち
+   *  16 耳 ほへとち ドル
+   *  17 ほへとち ドルーパル
+   *  18 へとち ドルーパル大好き
+   */
+  
+  function getTextJpn($n) {
+    $words = "以呂波耳・ほへとち。ドルーパル大好き！";
+    return drupal_substr($words, $n, (2 * $n) + 3);
+  }
 
   /**
    * Run predefine queries looking for indexed terms.
@@ -152,6 +173,25 @@
       $this->_testQueryMatching($query, $set, $results);
       $this->_testQueryScores($query, $set, $results);
     }
+    
+    // These queries are run agains the third index type, SEARCH_TYPE_JPN.
+    $queries = array(
+      // Simple AND queries.
+/*       '以呂波' => array(13), */
+      '呂波耳' => array(14),
+      '以呂波耳' => array(),
+/*       'へとち' => array(15, 16, 17, 18), */
+      'ほへと　ドルー' => array(17),
+      'ほへとち　ドルーパル' => array(17),
+      'ドルーパル' => array(17, 18),
+      'ヘとちーパル大' => array(),
+      'へとち大好き' => array(),
+    );
+    foreach ($queries as $query => $results) {
+      $set = do_search($query, SEARCH_TYPE_JPN);
+      $this->_testQueryMatching($query, $set, $results);
+      $this->_testQueryScores($query, $set, $results);
+    }      
   }
 
   /**
