如何使用 Sphinx / Manticore 搜索包含斜杠(“/”)的术语?

How to search terms containing slash ("/") with Sphinx / Manticore?

我正在尝试查找术语“/book”的匹配项,而不仅仅是“book”,但 Manticore returns 两个术语的结果相同。索引类型为 rt 并且 charset_table 包括斜杠 ("/")。我怎样才能只获得“/book”匹配项?

实时模式

mysql> drop table if exists t; create table t(f text) charset_table = 'non_cjk, /'; insert into t(f) values ('book'), ('/book'); select * from t where match('\/book'); select * from t where match('book');
--------------
drop table if exists t
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
create table t(f text) charset_table = 'non_cjk, /'
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
insert into t(f) values ('book'), ('/book')
--------------

Query OK, 2 rows affected (0.01 sec)

--------------
select * from t where match('\/book')
--------------

+---------------------+-------+
| id                  | f     |
+---------------------+-------+
| 1514651075267788906 | /book |
+---------------------+-------+
1 row in set (0.00 sec)

--------------
select * from t where match('book')
--------------

+---------------------+------+
| id                  | f    |
+---------------------+------+
| 1514651075267788905 | book |
+---------------------+------+
1 row in set (0.00 sec)

普通模式

普通索引

source src {
    type = csvpipe
    csvpipe_command = echo "1,book" && echo "2,/book"
    csvpipe_field = f
}

index idx {
    path = /tmp/idx
    source = src
    charset_table = non_cjk, /
    stored_fields = f
}

searchd {
    listen = 127.0.0.1:9315:mysql41
    log = sphinx_min.log
    pid_file = searchd.pid
    binlog_path =
}
mysql> select * from idx where match('\/book');
+------+-------+
| id   | f     |
+------+-------+
|    2 | /book |
+------+-------+
1 row in set (0.00 sec)

mysql> select * from idx where match('book');
+------+------+
| id   | f    |
+------+------+
|    1 | book |
+------+------+
1 row in set (0.00 sec)

RT指数

index t {
    type = rt
    path = /tmp/idx
    rt_field = f
    charset_table = non_cjk, /
    stored_fields = f
}

searchd {
    listen = 127.0.0.1:9315:mysql41
    log = sphinx_min.log
    pid_file = searchd.pid
    binlog_path =
}
mysql> insert into t(f) values ('book'), ('/book'); select * from t where match('\/book'); select * from t where match('book');
Query OK, 2 rows affected (0.00 sec)

+---------------------+-------+
| id                  | f     |
+---------------------+-------+
| 1514659513871892482 | /book |
+---------------------+-------+
1 row in set (0.00 sec)

+---------------------+------+
| id                  | f    |
+---------------------+------+
| 1514659513871892481 | book |
+---------------------+------+
1 row in set (0.00 sec)