设置Sphinx搜索

时间:2015-09-07 20:10:24

标签: ubuntu-14.04 sphinx

我一直在网上寻找教程来设置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)

然而,当我尝试并运行"搜索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'

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

我已经对此失去了理智,所以会很感激有人的帮助。

由于

1 个答案:

答案 0 :(得分:0)

您的each' from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/attr_encrypted-1.3.4/lib/attr_encrypted.rb:125:in无效。消息说,它需要包含attr_encrypted' from /home/kop/rails/howtobuyafranchise/lib/franchise_core/lib/models/billing_info.rb:6:in

但是,强烈建议使用<top (required)>' from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in工具 - 它已损坏。跳过它。 (推荐使用的文章已过时) - sql_query_info仅由block in require' from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in使用。

直接开始require' from /home/kop/rails/howtobuyafranchise/lib/franchise_core/lib/franchise.rb:35:in,如果还没有申请,请使用require' from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in。使用each' from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in测试索引要好得多。