Php+sphinx+scws is invalid in Chinese and valid in English.

/ / I don"t know what"s going on, just go to the code:

header ("Content-type: text/html; charset=utf-8");
$b_time = microtime (true);
$key = trim (I ("key"));
$index = "test1";
/ / = participle

$so = scws_new ();
$so- > set_charset ("utf-8");

/ default thesaurus
$so- > add_dict (ini_get ("scws.default.fpath"). / dict.utf8.xdb");
/ / Custom thesaurus
/ / $so- > add_dict (". / dd.txt",SCWS_XDICT_TXT);
/ / default rules
$so- > set_rule (ini_get ("scws.default.fpath"). "/ rules.utf8.ini");

/ / set whether to remove some special punctuation marks when returning the result of participle
$so- > set_ignore (true);

/ / sets whether the participle returns the result of compound segmentation, such as "Chinese" returns the words "Chinese + people + Chinese".
/ / bitwise XOR 1 | 2 | 4 | 8: short words | binary | main words | all words
/ / 1 SCWS_MULTI_SHORT SCWS_MULTI_DUALITY SCWS_MULTI_ZMAIN SCWS_MULTI_ZALL
$so- > set_multi (false);

/ / sets whether idle text is automatically aggregated by two-character participle
$so- > set_duality (false);

/ / set the search term
$so- > send_text ($key);
$words_array = $so- > get_result ();
$words1 = "";
foreach ($words_array as $v) {
$words1 = $words1. "| (". $v ["word"]. ")";
}

/ / add the whole word
$words1 = trim ($words1,"|");
$so- > close ();
echo"

enter:". $key.

";
echo"

participle:". $words1. "

";
/ = search for
$sc = new SphinxClient ();
$sc- > SetServer ("127.0.0.1 times, 9312);
$sc- > SetMatchMode (SPH_MATCH_EXTENDED);
$sc- > SetArrayResult (true);
$res = $sc- > Query ($words1, $index);
print_r ($res);
$e_time = microtime (true);
$time = $e_time-$baked timeout;
print_r ("Total time:" $time);

? >

Mar.09,2022
Menu