【问题标题】:Sphinx search is not working in my wamp environment?狮身人面像搜索在我的 wamp 环境中不起作用?
【发布时间】:2012-05-06 07:02:13
【问题描述】:

您好,我尝试在我的 WAMP 环境中配置 sphinx 搜索。

这是我的 sphinx.conf 文件

#
# Minimal Sphinx configuration sample (clean, simple, functional)
#

source combinedobject
{
    type            = mysql

    sql_host        = localhost
    sql_user        = root
    sql_pass        = root
    sql_db          = digi_inter
    sql_port        = 3306  # optional, default is 3306

    sql_query       = \
        SELECT file_id, file_idas int_attr, object_type_id, searchtext from image_gallery ;

    sql_attr_uint           = int_attr
    sql_attr_uint           = object_type_id
    sql_field_string        = searchtext

    sql_query_info      = SELECT * FROM image_gallery WHERE file_id=$id
}


index combinedobject
{
    source          = combinedobject
    path            = D:\PHP_Projects\DigiInternational\sphinx\data\combinedobject
    docinfo         = extern
    charset_type    = sbcs
}



indexer
{
    mem_limit       = 32M
}


searchd
{
    listen          = 9312
    log             = D:\PHP_Projects\DigiInternational\sphinx\log\searchd.log
    query_log       = D:\PHP_Projects\DigiInternational\sphinx\log\query.log
    pid_file        = D:\PHP_Projects\DigiInternational\sphinx\log\searchd.pid
    max_matches     = 1000
    compat_sphinxql_magics  = 1
}

我在 api 文件夹中创建了这种 php 文件

<?php
$searchName = "food";
require_once('sphinxapi.php');
//Sphinx
$s = new SphinxClient();
$s->setServer("localhost", 8080);
$s->setMatchMode(SPH_MATCH_EXTENDED2);
$result = $s->query("@searchtext $searchName");
print_r($result);

?>

通过命令提示搜索文本显示结果。但是对于 file_id 和 object_type_id 它没有显示任何结果。

使用 php 没有任何显示。我的狮身人面像版本是 sphinx-0.9.8-win32。任何人都可以帮助我。

谢谢

【问题讨论】:

  • 什么 print_r($s->showLastError());显示?

标签: php mysql search error-handling sphinx


【解决方案1】:

啊!所以服务器正在监听端口 9312

listen          = 9312

那你为什么要尝试连接到 8080?

$s->setServer("localhost", 8080);

【讨论】:

    猜你喜欢
    • 2014-01-09
    • 2015-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-29
    • 1970-01-01
    相关资源
    最近更新 更多