User Tools

Site Tools


rt_tutorial

RT indexes by example

sphinx.conf:

index rt
{
    type = rt
    path = /sphinx/data/rtindex
    rt_field = title
    rt_field = content
    rt_attr_uint = gid
}

searchd
{
    listen = 9312
    listen = 9306:mysql41
    ...
}

Using it:

$ mysql -h 127.0.0.1 -P 9306
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 1.10.1-id64-dev (r2331)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> insert into rt (id, gid, title, content) values (1, 123, 'hello', 'world');
Query OK, 1 row affected (0.02 sec)

mysql> select * from rt where match('hello');
+------+--------+------+
| id   | weight | gid  |
+------+--------+------+
|    1 |   1500 |  123 |
+------+--------+------+
1 row in set (0.02 sec)

mysql> delete from rt where id=1;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from rt;
Empty set (0.00 sec)

INSERT, REPLACE, DELETE, and SELECT (with Sphinx specific limitations for now) should work.

rt_tutorial.txt · Last modified: 2014/02/10 07:56 (external edit)