1.coreseek 安装

http://blog.csdn.net/u011470322/article/details/45331439

http://www.coreseek.cn/docs/coreseek_3.2-sphinx_0.9.9.html#attributes

2.配置

参考http://www.coreseek.cn/docs/coreseek_3.2-sphinx_0.9.9.html#attributes

3.建立索引

/usr/local/coreseek/bin/indexer cn360  --rotate

4.测试查询中文

<?php
require_once('sphinxapi.php');
// Instantiate the sphinx client
$client = new SphinxClient();
// Set search options
$client->SetServer('localhost', 9312);
$client->SetConnectTimeout(1);
$client->SetArrayResult(true);
// $client->SetMatchMode( SPH_MATCH_ALL  );
$client->SetLimits ( 0, 200 );

// Query the index
$results = $client->Query('惠南工业区','cn360');
// Output the matched results in raw format
print_r($results['matches']);

$ids = array();
foreach ($results['matches'] as $item) {
    $ids[]= $item['id'];
}
var_dump($ids);

$CONF = array('mysql_host'=>'127.0.0.1', 'mysql_username'=>'test', 'mysql_password'=>'test', 'mysql_database'=>'python');
$db = mysql_connect($CONF['mysql_host'],$CONF['mysql_username'],$CONF['mysql_password']) or die("ERROR: unable to connect to database");
var_dump($db);
mysql_select_db($CONF['mysql_database'], $db) or die("ERROR: unable to select database");

$sql = "select * from cn360 where id in( " . implode(",", $ids) . ")";
$result = mysql_query($sql, $db);
if (mysql_num_rows($result) > 0) {
    //Fetch Results from Mysql (Store in an accociative array, because they wont be in the right order)
    $rows = array();
    while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
        $rows[$row['id']] = $row;
    }
    print_r($rows);
}

$docs = array();
foreach($ids as $id) {
    if(isset($rows[$id])) {
        $docs[] = $rows[$id];
    }
}

print_r($docs);

result:

Array
(
    [0] => Array
        (
            [id] => 5
            [number] => 059527309155
            [tag] => 谢月明个人
            [address] => 福建 惠安县 惠南工业区
        )

[1] => Array
        (
            [id] => 36255
            [number] => 07522614783
            [tag] => 惠州市惠城区裕达五金塑料电镀加工厂
            [address] => 广东省 惠州市 惠城区 惠环镇平南工业区47号
        )

[2] => Array
        (
            [id] => 44990
            [number] => 07522622888
            [tag] => 惠胜五金塑胶制品有限公司
            [address] => 广东省 惠州市 惠城区 平南工业区(陈江车管所旁边)
        )

[3] => Array
        (
            [id] => 102436
            [number] => 059513328899953
            [tag] => 泉州鸿新工艺有限公司
            [address] => 福建省 泉州市 惠安县 东园镇惠安县东园镇惠南工业区
        )

[4] => Array
        (
            [id] => 36188
            [number] => 07522602821
            [tag] => 惠州赛达电镀制品有限公司
            [address] => 广东省 惠州市 惠城区 惠环镇平南工业区
        )

[5] => Array
        (
            [id] => 41243
            [number] => 07522600161
            [tag] => 惠州宏利五金塑胶制品厂有限公司
            [address] => 广东省 惠州市 惠城区 惠环镇平南工业区49号小区
        )

[6] => Array
        (
            [id] => 49407
            [number] => 075589958311
            [tag] => 华艺惠尔陶艺制品(深圳)有限公司
            [address] => 广东省 广州市 越秀区 布吉坂田五和南和勘工业区一栋三楼
        )

[7] => Array
        (
            [id] => 142891
            [number] => 057582976506
            [tag] => 上虞市虞南金属拉丝有限公司
            [address] => 浙江省 绍兴市 诸暨市 丰惠镇谢桥工业区3号
        )

[8] => Array
        (
            [id] => 60476
            [number] => 07522318512
            [tag] => 信全精密五金(惠州)有限公司
            [address] => 广东省 惠州市 惠城区 中心工业区南2号
        )

)

coreseek note相关推荐

  1. 更好的设计接口_设计可以而且必须做得更好

    更好的设计接口 We live in a world that becomes more dependent on technology every day. Tech gives us new wa ...

  2. 大流行时代的三大社会技术影响

    Well- Here we are. Just a few years after Bill Gates started warning us about the impending crises f ...

  3. 梦之安魂曲 minisd_科技运动中妇女的安魂曲

    梦之安魂曲 minisd This article was inspired by a conversation with fellow Medium user @hollyjahangiri. Bi ...

  4. 警察规范执法案例_警察改革沉浸式技术可以改变执法方式

    警察规范执法案例 Whenever a cop car pulls up beside or behind me while driving, I get nervous. My mouth beco ...

  5. 过去的互联网,modnet的出现

    This content is released under a Creative Commons Attributions license. Feel free to use these ideas ...

  6. 管理沟通 移情原则_解决技术上的移情差距

    管理沟通 移情原则 by Arathi Mani 通过Arathi Mani I sat in a wind tunnel for the first time while attending a s ...

  7. Coreseek:部门查询和增量索引代替实时索引

    1.行业调查 索引系统需要通过主查询来获取所有的文档信息,一个简单的实现是整个表的数据到内存,但是这可能会导致整个表被锁定,并且使其它操作被阻止(例如:在MyISAM格款式上INSERT操作).同时, ...

  8. Sphinx 0.9.9/Coreseek 3.2 参考手册

    Sphinx 0.9.9/Coreseek 3.2 参考手册 Sphinx--强大的开源全文检索引擎,Coreseek--免费开源的中文全文检索引擎 Copyright © 2006-2010 (co ...

  9. CoreSeek 安装问题解决及使用

    Coreseek 安装 1.Coreseek报错信息:无法生成configure文件,option 'subdir-objects' is disabled,AM_PROG_AR缺失  解决办法:在c ...

最新文章

  1. thinkphp5框架一小时搭建一个php后端(1)
  2. 如何利用FineReport制作动态树报表
  3. select标签动态获取数据时如何控制下拉框长度
  4. mongodb 安装pymongo 驱动
  5. java设计模式:Builder模式
  6. Git 工具 - 子模块 外部引用
  7. iOS11 与 iPhone X适配的那些坑(持更中...)
  8. 30 个实例详解 TOP 命令
  9. [集训队作业2018] 万圣节的积木(李超线段树)
  10. 《红色警戒3》新单位详细介绍:忍者
  11. 【图像处理基础知识】-混合高斯背景建模
  12. Python知识点汇总
  13. JCMsuite应用:闪耀光栅
  14. C语言----输入人数和姓名,输出最长姓名
  15. c语言假币问题的编程,假币问题 (C语言代码)
  16. 2004-2020中小企业板上市公司财务报表股票交易董事高管等面板数据
  17. 【APICloud系列|1】华为应用市场 应用版权证书或代理证书怎么填
  18. 安卓手机玩游戏卡顿怎么解决_安卓手机卡顿怎么办?5招教你变流畅,继续用三五年,媲美iPhone...
  19. 【转】Android兼容性测试的一些坑
  20. 如何设置按组分页同时每页的行数为固定的行数

热门文章

  1. web安全防火墙介绍
  2. Wayland协议解析 一 什么是Wayland
  3. LeetCode 字符串(简单题)
  4. 面向交通预测的动态图卷积循环神经网络:基准和方法(重磅推荐)
  5. 2022年上海应届生落户政策!没有社保基数要求,能直接落户!
  6. CompareTo和compare的区别
  7. 华大HC32L196移植Sx1268
  8. Util-linux
  9. 免费的PDF在线合并工具,拿走不谢!
  10. 用户满意您的产品吗?20个用户体验调查问题给您答案