设置 Sphinx 搜索

Setting up Sphinx Search

我一直在寻找在线教程来设置 sphinx 搜索,我已经让测试数据库正常工作。但是我无法让自己的数据库正常工作。

sphinx.conf

source src1
{
  type          = mysql

  sql_host      = localhost
  sql_user      = root
  sql_pass      = MyPassword
  sql_db        = MyDatabase
  sql_port      = 3306

  sql_query     = \
  SELECT listing_id, title, description, image_id \
  FROM listings

  sql_attr_uint       = listing_id

  sql_query_info        = SELECT listing_id, title, description, image_id      FROM listings

}
index test1
{
  source            = src1
  path              = /var/lib/sphinxsearch/data/test1
  docinfo           = extern
  charset_type      = sbcs
}
searchd
{
  listen            = 9312
  log               = /var/log/sphinxsearch/searchd.log

但是当我尝试 运行:

sudo indexer --all --rotate

putty 中的输出为:

using config file '/etc/sphinxsearch/sphinx.conf'...
indexing index 'test1'...
WARNING: attribute 'listing_id' not found - IGNORING
WARNING: Attribute count is 0: switching to none docinfo
WARNING: collect_hits: mem_limit=0 kb too low, increasing to 24576 kb
collected 3 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 3 docs, 49 bytes
total 0.002 sec, 16740 bytes/sec, 1024.94 docs/sec
total 2 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 6 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
rotating indices: succesfully sent SIGHUP to searchd (pid=911)

但是,当我尝试 运行 "search df" 时,我得到:

Sphinx 2.0.4-id64-release (r3135)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/etc/sphinxsearch/sphinx.conf'...
FATAL: 'sql_query_info' value must contain '$id'

我正在 运行ning Sphinx Search on Ubuntu 14.04 使用名为 "user" 的帐户,该帐户是 sudoers 文件的一部分。

我对此失去了理智,非常感谢有人的帮助。

谢谢

您的sql_query_info无效。如消息所述,它需要包含 $id

但是,强烈建议 不要 使用 search 工具 - 它已损坏。跳过它。 (推荐使用它的文章已过时)- sql_query_info 仅被 search 使用。

直接开始 searchd,如果还没有申请,请使用 test.php。使用 test.php 测试您的索引要好得多。