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
                        )

                )

        )

原文地址:https://www.cnblogs.com/flex_fly/p/1759514.html