Sphinx - 将 OR 运算符与字段 start/end 修饰符相结合
Sphinx - combine OR operator with field start/end modifier
这个表情写对了吗?因为我没有收到预期的所有结果:
(@nationality_code ("^MD$" | "^GB$" | "^IT$"))
我应该让国籍代码等于 'MD' 或 'GB' 或 'IT'
的所有用户
应该像 mysql 中的这个查询:
SELECT * FROM users WHERE nationality_code IN ('MD', 'GB', 'IT')
更新
如果我只搜索 MD 和 GB,我会收到正确的结果:
我执行的查询是这样的:
SELECT id, nationality_code
FROM jobs_applied_main
WHERE MATCH('(@nationality_code ("^MD$" | "^GB$"))') AND job_id = '6257'
LIMIT 0, 999;
但是如果我也添加“^IT$”,我就不会再获得国籍为 "MD" 的用户了。
如果我删除 start/end 修饰符,我会收到预期的结果,为什么会这样?
更新
所以,这里是我的索引转储和 sphinx.conf 文件:sphinx-dump
是的。表达是对的。它对我来说很好用:
[snikolaev@dev01 ~]$ mysql -P9314 -h0
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 2.7.1 668faae@180620 dev
Copyright (c) 2009-2017 Percona LLC and/or its affiliates
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from idx_min where match('(@nationality_code ("^MD$" | "^GB$" | "^IT$"))');
+------+------------------+------+
| id | nationality_code | a |
+------+------------------+------+
| 1 | MD | 123 |
| 2 | GB | 123 |
+------+------------------+------+
2 rows in set (0.00 sec)
确保索引中确实只有 MD/GB/IT 而没有 before/after 并且没有 min_word_len < 2.
Sphinx 3.0.3 版本有问题,因为 Sphinx 2.2.11 可以正常工作
这个表情写对了吗?因为我没有收到预期的所有结果:
(@nationality_code ("^MD$" | "^GB$" | "^IT$"))
我应该让国籍代码等于 'MD' 或 'GB' 或 'IT'
的所有用户应该像 mysql 中的这个查询:
SELECT * FROM users WHERE nationality_code IN ('MD', 'GB', 'IT')
更新 如果我只搜索 MD 和 GB,我会收到正确的结果:
我执行的查询是这样的:
SELECT id, nationality_code
FROM jobs_applied_main
WHERE MATCH('(@nationality_code ("^MD$" | "^GB$"))') AND job_id = '6257'
LIMIT 0, 999;
但是如果我也添加“^IT$”,我就不会再获得国籍为 "MD" 的用户了。
如果我删除 start/end 修饰符,我会收到预期的结果,为什么会这样?
更新 所以,这里是我的索引转储和 sphinx.conf 文件:sphinx-dump
是的。表达是对的。它对我来说很好用:
[snikolaev@dev01 ~]$ mysql -P9314 -h0
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 2.7.1 668faae@180620 dev
Copyright (c) 2009-2017 Percona LLC and/or its affiliates
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from idx_min where match('(@nationality_code ("^MD$" | "^GB$" | "^IT$"))');
+------+------------------+------+
| id | nationality_code | a |
+------+------------------+------+
| 1 | MD | 123 |
| 2 | GB | 123 |
+------+------------------+------+
2 rows in set (0.00 sec)
确保索引中确实只有 MD/GB/IT 而没有 before/after 并且没有 min_word_len < 2.
Sphinx 3.0.3 版本有问题,因为 Sphinx 2.2.11 可以正常工作