设置Sphinx

时间:2009-09-16 02:41:09

标签: php mysql indexing sphinx

呵呵,不要嘲笑我,只是想在我当地的WAMP上设置Sphinx,我之前没有这样做过,所以我可能会做些傻事。

这是我的sphinx.conf文件:

source code
{
    type = mysql
    sql_host = localhost
    sql_user = root
    sql_pass =
    sql_db = ****
    sql_port = 3306
    sql_query = SELECT id, language_id, category_id, title, description, UNIX_TIMESTAMP(time_posted) AS time_posted FROM codes
    sql_attr_uint = language_id
    sql_attr_uint = category_id
    sql_attr_timestamp = time_posted
    sql_query_info = SELECT id FROM codes WHERE id=$id
}

index code
{
    source = code
    path = C:/Program Files/Wampserver 2/sphinx/var/data/sphinx/code
    morphology = stem_en
    min_word_len = 3
    min_prefix_len = 0
}

searchd
{
    port = 3312
    log = C:/Program Files/Wampserver 2/sphinx/var/log/searchd/searchd.log
    query_log = C:/Program Files/Wampserver 2/sphinx/var/log/searchd/query.log
    pid_file = C:/Program Files/Wampserver 2/sphinx/var/log/searchd/searchd.pid
}

当我尝试索引时,我收到此错误:

ERROR: index 'code': column number 1 has no name.

这个问题的原因是什么? 感谢。

4 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

只需使用官方PHP分发 php-5.2.1-Win32.zip 中的MySql版 5.0.37 替换文件bin / libmySQL.dll。

答案 2 :(得分:-1)

您需要将libmysqlclient15-dev软件包版本等于libmysqlclient15的版本。你呢?

答案 3 :(得分:-1)

没有什么明显的。我已经创建了一个包含这些列的表,在Mac和Windows框上运行索引,并且它两次都正确索引。我正在使用sphinx 0.9.9-rc2,也许这是一个版本问题?

C:\Sphinx\bin>indexer.exe --config c:\Sphinx\test.conf
Sphinx 0.9.9-rc2 (r1785)
Copyright (c) 2001-2009, Andrew Aksyonoff

using config file 'c:\Sphinx\test.conf'...
WARNING: key 'port' is deprecated in c:\Sphinx\test.conf line 27; use 'listen' i
nstead.
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg

C:\Sphinx\bin>