请看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”这种格式就好了。

sphinx分域搜索【不】需要在conf文件中使用sql_field_string的更多相关文章

  1. /etc/resolv.conf文件中的search项作用;如何保持resolv.conf文件内容不被修改

    /etc/resolv.conf文件中的search项作用 resolv.conf文件中有search项时,主机名解析规则顺序: DNS配置文件如下: # cat /etc/resolv.conf ; ...

  2. /etc/resolv.conf文件中的search项作用

    resolv.conf文件中有search项时,主机名解析规则顺序: DNS配置文件如下: # vi /etc/resolv.conf # Generated by NetworkManager se ...

  3. sphinx分域搜索

    http://stackoverflow.com/questions/2526407/complex-query-with-sphinx 比如要实现和如下sql代码相同的功能: SELECT * FR ...

  4. egrep对于conf文件中去掉#注释,排除无用项

    [root@localhost conf]# egrep -v "#|^$" nginx.conf.default > nginx.conf dd

  5. nginx反向代理配置(conf文件中的nginx)

    ########### 每个指令必须有分号结束.##################user administrator administrators;  #配置用户或者组,默认为nobody nob ...

  6. inetd.conf文件中的字段

  7. PKG_CONFIG_PATH变量 与 ld.so.conf 文件

    一.编译和连接 一般来说,如果库的头文件不在 /usr/include 目录中,那么在编译的时候需要用 -I 参数指定其路径.由于同一个库在不同系统上可能位于不同的目录下,用户安装库的时候也可以将库安 ...

  8. Linux系统下的/etc/nsswitch.conf文件

    一.什么是nsswithch.conf(服务搜索顺序)文件呢? nsswitch.conf(name service switch configuration,名字服务切换配置)文件位于/etc目录下 ...

  9. VSFTPD全攻略(/etc/vsftpd/vsftpd.conf文件详解)

    /etc/vsftpd/vsftpd.conf文件详解,分好类,方便大家查找与学习 #################匿名权限控制############### anonymous_enable=YE ...

随机推荐

  1. angular模拟elema网页1

    我们之前做的所有的网页项目都用的是假的json数据,真正的前后端的数据交互是个什么情况的呢?现在,我们就来看看. 首先,我们需要进行环境窃取,我们需要一个真实的数据,但是人家公司肯定不会将数据给你的, ...

  2. 文本注释系统 + MarkDown

    标记系统: 笔记的要点 题材 缘起 目标 等级: 细节性 事实性 规律 法则 适用范围: 时间.地点.人物.起因.经过.结果,who what where when why how whom 6W1H ...

  3. android应用开发小技巧

    1,实现应用可以安装到SD卡里面去:在AndroidManifest.xml文件的manifest里面添加下面一行: 1 android:installLocation="preferExt ...

  4. VMware 8安装苹果操作系统Mac OS X 10.7 Lion正式版

    今天介绍下VM8下安装Mac OS X 10.7  1.工具篇       下载Vmware Workstation 8.0正式版http://115.com/file/bhyk1l2u#       ...

  5. VBS脚本代码(手工编写---在windows 7上调用系统对话框,来选择文件)

    '=========================================================================='' VBScript Source File - ...

  6. 新随笔ps泡泡制作

    http://jingyan.baidu.com/article/4d58d5413568a79dd4e9c016.html

  7. mybatis 总结(1)

    注意事项 1.在使用type 和JavaType 以及reusltType ,ofType的时候一定要设置"别名"在mybatis.cfg.xml中设置 <typeAlias ...

  8. LeetCode OJ 111. Minimum Depth of Binary Tree

    Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shor ...

  9. UIWebView是什么

    UIWebView类是用来显示网络内容.要使用它,可以简单的创造一个UIWebView对象,放置到窗口上,并且发送一个指向网络内容的请求.通过这个类,可以控制网页历史的前进後退,也可以通过程序去控制网 ...

  10. px和sp什么区别

    都表示像素,只不过sp通常表示文字大小: <TextView android:layout_width="wrap_content" android:layout_heigh ...