请看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. mongoDB7--游标

    之前我们学习了"增删改查"四中语法和查询表达式的深入学习,我们已经掌握了一定的操作mongodb数据的能力,那么接下来我们就要考虑我们的操作的效率问题了.(1)游标介绍如果我们查询 ...

  2. 多工段查询存放到DataTable到List<DataTable>集合在C#里面做汇总

    private void btnQuery_Click(object sender, EventArgs e) { if (cboxFactory.Text=="") { Mess ...

  3. Vim 配置Markdown

    通过vundle工具安装以下插件: vim-markdown   语法高亮 vim-markdown-preview.vim  通过浏览器实时预览(支持同步滚动) -/.vimrc vundle部分添 ...

  4. wmts调用路径手工合成

    wmts调用路径手工合成 一般OGC WMTS地图只提供了xml描述,地图应用常常要合成WMTS完整的调用URL.我们需要获知以下参数: BaseURL:例如 "http://10.36.5 ...

  5. CSS问题:怎么样让鼠标经过按钮的时候发生的状态一直停留在当页呢?

    $('p').mouseenter(function(){ $('p').css('background-color','yellow'); }); 只写一个mouseenter的动态效果的话是不能达 ...

  6. ExecutorService的submit(Runnable x)和execute(Runnable x) 两个方法的本质区别

    Runnable任务没有返回值,而Callable任务有返回值.并且Callable的call()方法只能通过ExecutorService的submit(Callable <T> tas ...

  7. Spring 框架理论基础

    一. IOC 控制反转 概念解释:当我需要一个资源时,容器已经帮我准备好,我只需要接受就可以. // 加载 IOC 容器 ApplicationContext ac = new ClassPathXm ...

  8. php curl 获取 HTTPS

    注意:谷歌的话开vpn可能才可以,goagent也不行function getHTTPS($url) {  $ch = curl_init();  curl_setopt($ch, CURLOPT_S ...

  9. find文件后cp、rm

    复制: find <src-path> -name 'some names' -exec cp {} <dest-path> \; find <src-path> ...

  10. Xcode6无法用xib得问题解决方法

    1.创建一个新工程,选择singleView application 2.将storyboard和launchscreen删除,选择moveToTrash 3.删除info.plist文件中Main ...