Differences
This shows you the differences between the selected revision and the current version of the page.
searching_index_for_japanese 2010/01/15 00:33 | searching_index_for_japanese 2020/02/06 11:04 current | ||
---|---|---|---|
Line 4: | Line 4: | ||
It is because that the latest version of PunBB does not create searching words (table:search_words) appropriately. | It is because that the latest version of PunBB does not create searching words (table:search_words) appropriately. | ||
- | The searching words is split and created at search_idx.php, but no Japanese words is created because Japanese words is splitted by white-spaces. Therefore, splitting Japanese sentence into Japanese words is very difficult. | + | The searching words are split and created at search_idx.php, but no Japanese word is created. Because Japanese words in a sentence is not split by whitespaces or other chars. In order to split appropriate words, we need some large Japanese dictionary and a specific analytical program. It's not small work. |
====== How to solve====== | ====== How to solve====== | ||
Line 21: | Line 21: | ||
// Split Japanese words by using Yahoo Web API if there are Japanese chars. | // Split Japanese words by using Yahoo Web API if there are Japanese chars. | ||
$text = split_japanese_words($text); | $text = split_japanese_words($text); | ||
+ | </code> | ||
+ | |||
+ | |||
+ | One character of Japanese Kanji may be meaningful. So change FORUM_SEARCH_MIN_WORD to 1 at line 20 in search_idx.php | ||
+ | <code php> | ||
+ | if (!defined('FORUM_SEARCH_MIN_WORD')) | ||
+ | define('FORUM_SEARCH_MIN_WORD', 1); | ||
</code> | </code> | ||
Line 28: | Line 35: | ||
-**YAHOO_API_CODE**: Set Yahoo API Code. You must obtain it from Yahoo. Each application is restricted to access for 50,000 times in 24 hours.) | -**YAHOO_API_CODE**: Set Yahoo API Code. You must obtain it from Yahoo. Each application is restricted to access for 50,000 times in 24 hours.) | ||
- | -**function has_japanese_chars**: Checking existence of Japanese charactters | + | -function **has_japanese_chars**: Checking existence of Japanese charactters |
- | -**split_japanese_words**: Send request to Yahoo Web API with parameters. The filter is set to 9|10 to request 'noun' and 'verb' words. The words are extracted from XML data and are imploded. | + | -function **split_japanese_words**: Send request to Yahoo Web API with parameters. The filter is set to 9|10 to request 'noun' and 'verb' words. The words are extracted from XML data and are imploded. |
<code php> | <code php> | ||
if (!defined('YAHOO_API_CODE')) | if (!defined('YAHOO_API_CODE')) | ||
- | define('YAHOO_API_CODE','_F3TRHexg64WGN7BkqBt03OePtRKDon8qrFE6wWnEY.R7OWqPXVkHxJsTokT_Ijfa5w-'); | + | define('YAHOO_API_CODE','_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-'); |
/* | /* | ||
Line 76: | Line 83: | ||
===== Modification of SQL ===== | ===== Modification of SQL ===== | ||
See also this post in the forum. | See also this post in the forum. | ||
- | *http://punbb.informer.com/forums/post/119577/ | + | *https://punbb.informer.com/forums/post/119577/ |