ES 全文检索 ----整理 【 https://www.elastic.co/cn/ 官网地址 】
百度云盘 【lnmp. ppt】 查看,linux ,nginx 等安装,es ,kibana 安装参考 【 1安装elastic search 相关.doc】
http://blog.csdn.net/itfootball/article/details/53637238 报No alive nodes found in your cluster
参考地址 https://my.oschina.net/zqouba/blog/910286
1.服务器上 安装elastic...
2.config: 两台服务器时,需要 处理如下

3.引入类库
1.引入类库 5.61 版本
4. 名称空间
namespace Home\Controller;
use Elasticsearch\ClientBuilder;
class SearchbuildController extends BaseController{
function _initialize(){
parent::_initialize();
vendor('Elasticsearch.autoload');
}
创建索引 ,添加索引,删除索引 createIndex,addIndex,deleteIndex 链接9200(端口) 后拼接该方法,进行调用
创建/新增/删除 索引 GPortal\Source\Application\Manage\Common\ function.php updateEsDocument deleteEsDocument
(内容重新审核,状态变更时 ,需要调用方法 处理)
------ 参考链接:https://blog.csdn.net/u013090676/article/details/79482166
http://www.imooc.com/article/18578?block_id=tuijian_wz
另一种分词器,后缀模糊匹配还是比较慢的,词短建议用ngram,处理中文时 不会把每个中文字都拆开。
数字 查询时使用
前缀
https://elasticsearch.cn/question/427 按照匹配词靠前排序 (未测试)
前台:
<div class="jsuo clearfix">
<input class="input" maxlength="25" name="searchValue" id="searchValue" type="text" value="{$searchvalue}" onkeydown="if(event.keyCode==13){$('#searchButton').click();return false;}">
<input id="searchButton" type="button" class="input02" value="搜索">
</div>
<script src="__PUBLIC__/home/js/laypage/laypage.js"></script>
$(function(){
//搜索
$('#searchButton').click(function(){
var content = encodeURIComponent($.trim($('#searchValue').val()));
window.location.href = "/search/index.html?content="+content;
})
//分页
var content = $.trim($('#searchValue').val());
initLinkPage({cont:'page',sum:{$pages},content:content});
})
//分页
function initLinkPage(page){
var first=page.first!=undefined?page.first:'首页';
var last=page.last!=undefined?page.last:'尾页';
laypage({
cont: $("#"+page.cont), //容器。值支持id名、原生dom对象,jquery对象,
pages: page.sum, //总页数
//skip: skip, //是否开启跳页
skin: '#0082cd',//颜色
groups: page.group || 10, //连续显示分页数
first:first,
last:last,
curr: function(){ //通过url获取当前页,也可以同上(pages)方式获取
var page = location.search.match(/page=(\d+)/);
return page ? page[1] : 1;
}(),
jump: function(e, first){ //触发分页后的回调
if(!first){ //一定要加此判断,否则初始时会无限刷新
location.href = '?content='+page.content+'&page='+e.curr;
}
if(page.view){
var pageurl = location.search.match(/page/);
if(pageurl != null){
//定位
var y=$("#"+page.view).offset().top;
window.scrollTo(0,y);
}
}
}
});
}
后台 : 注意

将 $content 变量 换一个名字,避免安全报告 有如上图提示错误
标题 显示在前
Laravel Scout +es 搜索高亮显示 :
https://laravel-china.org/articles/4038/tutorial-two-write-a-search-solve-the-search-results-highlight-the-problem-using-laravel-scout-elasticsearch-ik-word-segmentation

浙公网安备 33010602011771号