medcl / elasticsearch-rtf

elasticsearch中文发行版,针对中文集成了相关插件,方便新手学习测试.
Apache License 2.0
2.67k stars 715 forks source link

想知道怎么样才能搜索到特殊字符,如'+' #46

Open jinrongchen opened 8 years ago

jinrongchen commented 8 years ago

我这边用的环境是rtf的版本,没用其他的专门的插件之类的,语言为PHP 通过PHP的CURL来模拟提交实现的搜索

$ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//show result on your screen if($post) { if ($isjson) { curl_setopt($ch, CURLOPT_POSTFIELDS, $data); } else { curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data,JSON_UNESCAPED_SLASHES)); } } curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // if any redirection after upload $data = curl_exec($ch);//run by curl $data = json_decode($data,true); return $data;

传入的filter如下:

$filter = array( "bool"=>array( "must"=>array( array("match"=>array("subject"=>$keyword)), array("range"=>array("displayorder"=>array("gte"=>0))) ), "must_not"=>array(), "should"=>array() ) );

Steven-Z-Yang commented 8 years ago

特殊字符别分词,就肯定可以搜索到