sphinx分域搜索【不】需要在conf文件中使用sql_field_string
2024-10-19 09:00:28
请看sql_field_string的文档说明:
# combined field plus attribute declaration (from a single column)
# stores column as an attribute, but also indexes it as a full-text field
#
# sql_field_string = author
我们不需要attribute属性,不用管。只要在sql_query中选出相应的column就行了,就可以在php中使用extended_query_mode来进行query了,相应的域名就是列的名字。请看如下的conf文件:
sql_query = \
SELECT bid, review_count, stars, name, full_address, categories \
FROM busi_info sql_attr_uint = review_count
sql_attr_uint = stars
在php中搜索的时候,php文件如下:
<?php
ini_set('memory_limit', '-1');
ini_set('max_execution_time', '100');
include 'sphinxapi.php'; $sc= new SphinxClient();
$sc->setServer('localhost', 9312);
$sc->setRankingMode(SPH_RANK_NONE);
$sc->SetLimits(0,73180000,1000000); $sc->SetMatchMode(SPH_MATCH_EXTENDED2);
$res = $sc->query('@categories Travel', 'idx_busi');
$ids = array_keys($res['matches']);
print_r($ids); ?>
这样就行啦!只要用“@域名 query”这种格式就好了。
最新文章
- [转] STM32各种时钟的区别
- 移动开发可能用到的css单位
- Python Day9
- 转!! PreparedStatement是如何防止SQL注入的
- Error Domain=ASIHTTPRequestErrorDomain Code=8 ";Failed to move file from";xxx/xxx";to";xxx/xxx";
- 从Hadoop Summit 2016看大数据行业与Hadoop的发展
- JVM_Bind:8080 的解决办法【131031】
- js弹窗
- easyui源码翻译1.32--DateBox(日期输入框)
- HttpClient4.4 进行Http连接通讯
- HDU_2058——等差数列,子集,集合长度判断
- 《SAS编程和数据挖掘商业案例》第14部分学习笔记
- 有人实践过 Phabricator 以及 Arcanist 作为 code review 的工具么?(转)
- Git 开发新的功能分支
- 启动Eclipse时An internal error occurred during: ";Initializing Java Tooling";.错误
- 动态规划-最长上升子序列(LIS)
- tensorflow 的数据管理
- 13. The Impact of New Technology on Business 新科技对商务的影响
- linux系统安全审计简单设置
- Codeforces Round #530 Div. 1 自闭记
热门文章
- 复用TCP连接提升流媒体服务器之间流量转发效率
- 十一、oracle 数据库管理员
- Load$$ execution region symbols
- 复习TextView(查漏补缺)
- SQLServer 错误: 15404,无法获取有关 Windows NT 组 用户
- 《JS权威指南学习总结--第三章类型、值和变量》
- PHP 5 数据类型
- hdu_5794_A Simple Chess(lucas+dp)
- nefu 519 昨日重现
- 第4章 流程控制----编写Java程序,使用while循环语句计算1+1/2!+1/3!+...+1/20!之和