coreseek/sphinx api

同时搜索‘广州’和‘科技’,$cl->query('广州 科技', 'company_info')得到的结果中

     'regcity' => int 1
  'matches' => 
    array
      81 => 
        array
          'weight' => string '1' (length=1)
          'attrs' => 
            array
              ...
  'total' => string '1' (length=1)
  'total_found' => string '1' (length=1)
  'time' => string '0.001' (length=5)
  'words' => 
    array
      '广州' => 
        array
          'docs' => string '9' (length=1)
          'hits' => string '9' (length=1)
      '科技' => 
        array
          'docs' => string '5' (length=1)
          'hits' => string '5' (length=1)

①matches下标对应的内容是真实得到的结果数目,这里只有一条,但是words下标的内容显示了‘广州’和‘科技’分别被搜索到多次,说明matches只返回最匹配的结果,这里的id为81的内容是“广州永利金盾科技有限公司”,既有广州又有科技。

②不显式的设置$cl->SetLimit();matches默认的是返回20条记录

③如果设置$cl->SetGroupBy();matches会将每一组中最匹配的结果返回,而不是将分成一组的记录都返回

"因此SetMatchMode()除了过滤关键字选择一个合适的排序外没有做任何事情"
(http://blog.csdn.net/pure2007/article/details/6623398)

posted @ 2012-06-28 14:14  myD  阅读(438)  评论(0编辑  收藏  举报