PublicDisplayName
PublicDisplayName

Reputation: 317

Setting up Sphinx Search

I've been looking for tutorials online to setup sphinx search, and I have got the test database working. However I am having trouble getting my own database to work.

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

However when I try and run:

sudo indexer --all --rotate

The output in putty is:

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)

However, when I try and run "search df" for example, I get:

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'

I am running Sphinx Search on Ubuntu 14.04 using an account called "user" which is part of the sudoers file.

I have lost my mind with this, so would appreciate someones help.

Thanks

Upvotes: 0

Views: 345

Answers (1)

barryhunter
barryhunter

Reputation: 21091

Your sql_query_info is invalid. It needs to contain $id, as the message says.

However, would highly recommend not using search tool - its broken. Skip it. (articles recommending its use, are outdated) - sql_query_info is only used by search.

Move right on to starting searchd, and use test.php if dont have an application yet. Using test.php to test your index is MUCH better.

Upvotes: 0

Related Questions