2013-03-20 106 views
0

我用PHP測試獅身人面像(教程:http://www.siteduzero.com/informatique/tutoriels/creer-un-moteur-de-recherche-avec-sphinx-et-php在PHP中使用Sphinx。 「搜索」錯誤:「搜索錯誤:。」

如果我運行 「搜索」 是這樣的:

search -i news navigateur 

我有以下錯誤:

index 'news': search error: . 

索引器作品罰款:

$ sudo indexer news
Sphinx 2.0.6-release (r3473) Copyright (c) 2001-2012, Andrew Aksyonoff Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/usr/share/php/sphinx/etc/sphinx.conf'... indexing index 'news'...

collected 57 docs, 0.7 MB sorted 0.1 Mhits, 100.0%

done total 57 docs, 689264 bytes total 0.050 sec, 13684561 bytes/sec, 1131.67 docs/sec

total 3 reads, 0.000 sec, 115.5 kb/call avg, 0.1 msec/call avg

total 9 writes, 0.000 sec, 83.5 kb/call avg, 0.0 msec/call avg

而且,用th e API,PHP代碼不會返回任何內容。有人已經有這個錯誤?

這裏的配置文件:

index news {

source = news 
    path = /usr/share/php/sphinx/var/data/news 

}

indexer {

mem_limit = 32M 

}

searchd {

port  = 3312 
    log  = /usr/share/php/sphinx/var/log/searchd/searchd.log 
    query_log = /usr/share/php/sphinx/var/log/searchd/query.log 
    pid_file = /usr/share/php/sphinx/var/log/searchd/searchd.pid 

}

source news {

type    = mysql 
    sql_host   = localhost 
    sql_user   = root 
    sql_pass   = 
    sql_db    = siteduzero_sphinx 
    sql_query_pre  = SET NAMES utf8 
    sql_query   = SELECT id\ 
           , categorie\ 
           , titre\ 
           , contenu FROM news 
    sql_attr_uint  = categorie 
    sql_query_info  = SELECT titre FROM news WHERE id=$id } 

感謝。

法布里斯

回答

0

它在search實用的錯誤。

好消息是search實用程序,只是一個測試工具,所以它並不重要。它沒有實際用於測試以外的其他任何事情。

至於你在API方面的問題,你有沒有運行searchd守護進程?

而不是隻是說,它返回「無」,你應該使用GetLastError和getLastWarning調查爲什麼...

1

恰好碰到了同樣的問題。最後一個配置參數中邪惡的根源。此命令將正常工作:

search -i news --noinfo navigateur 

或者你也可以從配置中刪除該字符串:

sql_query_info  = SELECT titre FROM news WHERE id=$id 

如果你不需要它。