SphinxQL + sphinxsearch table 不存在

SphinxQL + sphinxsearch table doesn't exists

今天我尝试将 sphinxsearch 与 SphinxQL 一起使用,但出现问题 =\ 首先,我安装了 sphinxsearch,然后对其进行了配置,之后我使用 indexer --all 创建了索引 forum_index。全部完成,没有错误。 然后我将 SphinxQl 包含到我的项目中,键入正在侦听 sphinx 的主机和端口,并尝试像 SphinxQL 的自述文件中那样进行查询:

// create a SphinxQL Connection object to use with SphinxQL
$conn = new Connection();
$conn->setParams(array('host' => 'localhost', 'port' => 9306))
;

但是导致数据库访问错误:

access denied www-data@localhost password NO

之后我在 SphinxQL 中使用

设置用户名和密码参数
 mysqli::real_connect()

以前的错误消失了 然后我尝试进行测试查询:

$query = SphinxQL::create($conn)->select('column_one', 'colume_two')
    ->from('forum_index');
$result = $query->execute();

但是我得到一个错误:

table forum_index doesn't exists

我感觉我的 SphinxQL 没有看到 sphinx 或 sphinx 配置,而是尝试进行简单查询。 你知道出了什么问题吗?

请转到命令行使用以下命令

mysql -P9306 --protocol=tcp --prompt='sphinxQL> '

一旦出现 sphinxQL 提示符,输入以下命令

sphinxQL> show tables;

如果一切设置正确,您可以在列表中看到 forum_index table。否则检查 sphinx.conf 文件中的 searchd 配置部分是否正确配置。我的配置看起来像这样

searchd {
  listen                  = 9315
  listen                  = 9306:mysql41
  log                     = /Users/XXXX/projects/sphinx/data/searchd.log
  query_log               = /Users/XXXX/projects/sphinx/data/query.log
  read_timeout            = 5
  max_children            = 30
  pid_file                = /Users/XXXX/projects/sphinx/data/searchd.pid
  max_matches             = 1000
  seamless_rotate         = 1
  preopen_indexes         = 0
  unlink_old              = 1
  workers                 = threads
  thread_stack            = 1024K
}

我通过在 SphinxQL 参数中设置 host = '127.0.0.1' 解决了我的问题