【问题标题】:Complex Query with Sphinx使用 Sphinx 进行复杂查询
【发布时间】:2010-03-26 20:10:39
【问题描述】:

我正在使用Sphinx Search。它对我来说很好,除了一个问题:我需要排除一些特定字段不包含单词的条目。

在 MySQL 中看起来像这样的东西:

SELECT * FROM table
   WHERE yescolumn = 'query' 
   AND othercolumn not like '%keyword%'

【问题讨论】:

    标签: php mysql sphinx


    【解决方案1】:

    您可以使用 Sphinx 的扩展查询语法来选择要搜索的字段。尝试像这样通过 Sphinx 运行查询:

    @yescolumn query @othercolumn -keyword
    

    因此,在 PHP 页面中,您可能有一个指向名为 $sphinx 的 Sphinx 数据库的链接:

    $sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
    $results = $sphinx->Query('@yescolumn query @othercolumn -keyword');
    

    更多信息在这里:http://www.sphinxsearch.com/docs/current.html#searching

    【讨论】:

      猜你喜欢
      • 2011-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-08
      • 2020-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多