【问题标题】:Search across different indexes using sphinx使用 sphinx 搜索不同的索引
【发布时间】:2014-06-09 11:28:50
【问题描述】:

我们正在尝试使用 sphinx 进行站点范围的搜索。这意味着,我们的搜索必须查看其中的所有主要索引和字段,并按相关性返回它们。

这是查询:

SELECT *
          FROM articles, users, genres
          WHERE match ('@(articles.title, genres.title, articles.description, users.nickname) test_sting')

但这似乎不起作用。有没有什么方法可以跨多个索引进行搜索并指定我们要搜索的字段?

【问题讨论】:

    标签: sphinx


    【解决方案1】:
    SELECT * FROM articles, users, genres WHERE match ('test_sting')
    

    应该只匹配所有索引中的所有字段,不需要指定具体字段。


    否则,您可以使用几乎没有记录的@@relaxed 运算符....

    SELECT * FROM articles, users, genres
          WHERE match ('@@relaxed @(title, description, nickname) test_sting')
    

    应该可以。它只会搜索那些命名的字段,但@@relaxed 意味着特定字段是否不存在于特定索引中并不重要。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多