Sphinx搜索:获取rt索引以使用mysql - 第一次

use*_*003 3 sphinx

我想让rt索引工作:http: //sphinxsearch.com/docs/current.html#rt-overview

我错过了sphinx和mysql之间的联系.

在sphinx.conf中我有:

index rt_test
{
        type = rt
        path = /home/my/path/sphinx/data/rt_test
        rt_field = title
        rt_field = content
}
Run Code Online (Sandbox Code Playgroud)

我运行/ home/path/bin/indexer --all

它告诉我

skipping non-plain index 'rt_test'... (which I read is as it should be)
Run Code Online (Sandbox Code Playgroud)

然后在mysql中(按照我通常的方式登录):

create table rt_test(id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT, title varchar(100),
content varchar(100));

insert into rt_test(title, content) values ("test title", "test content");

SELECT * FROM rt_test WHERE MATCH('test');
Run Code Online (Sandbox Code Playgroud)

这给了我一个"错误的语法"错误.这并不奇怪.Mysql只是认为我已经创建了一个常规表并插入了常规数据,现在它不了解Sphinx查询.

那么缺少什么链接?mysql如何了解sphinx?如果我不首先创建表,那么我得到一个表不存在的错误(sphinx没有从mysql查询"sphinx"表).

我在Linux上安装了sphinx,如下所述:http: //sphinxsearch.com/docs/current.html#installing

使用此版本:

wget http://sphinxsearch.com/files/sphinx-2.0.8-release.tar.gz

编辑:我也跑了$ searchd

It says:

WARNING: compat_sphinxql_magics=1 is deprecated; please update your applica
WARNING: preopen_indexes=1 has no effect with seamless_rotate=0
listening on all interfaces, port=9312
listening on all interfaces, port=9306
precaching index 'other'
precaching index 'rt_test'
precached 2 indexes in 0.012 sec
Run Code Online (Sandbox Code Playgroud)

use*_*003 5

我现在明白了.

我没有登录我的常规mysql数据库,但是(足够有趣)按照它说:

$ mysql -h 127.0.0.1 -P 9306
Run Code Online (Sandbox Code Playgroud)

然后我不创建表.只需插入和搜索.

我的常规数据库和sphinx mysql是完全分开的.我必须将我的所有数据都插入到我的常规数据库中,也插入到sphinx数据库中.然后在sphinx数据库中搜索并使用结果获取常规数据库中的完整数据.