Sphinx - 搜索查询是否包含字段值

时间:2013-06-12 11:21:44

标签: search substring sphinx reverse

我想用Sphinx搜索这样的案例:

tags表:

id    text
1     samsung
2     nokia
3     lg
4     lg.com
5     lg.com.uk
...

如果查询是:

  • I like lg - >匹配记录3
  • I like lg.com - >匹配记录4
  • I like samsung and lg - >匹配记录13

这个想法是查询应该包含列text作为其子字符串。它类似于SQL中的LIKE运算符,但与查询和列的顺序相反:

select * from tags where 'I like samsung and lg' like concat('%', text, '%')

我怎样才能在Sphinx中做到这一点? 谢谢。

0 个答案:

没有答案