sphinx中,直接取主键ID

sphinx.conf中 

sql_query    = \
  SELECT aid,aid AS testid, title,group_id \
  FROM documents

 

aid为主键ID,

必须AS成testid后,

再添加一个属性,sql_attr_uint   = testid

 

才可以显示成如下形式:

 

  [matches] => Array
        (
            [1] => Array
                (
                    [weight] => 1
                    [attrs] => Array
                        (
                            [testid] => 1                  ------------>显示出来了,这个问题搞了一下午,气人
                            [group_id] => 1
                        )

                )

        )

posted @ 2010-06-17 14:19  flex_fly  阅读(524)  评论(0编辑  收藏  举报