sphinx里sql_attr_string的问题
按文档的说法,sql_attr_string只存储不参与搜索,这样我在结果里面就可以直接得到设置了sql_attr_string属性的字段的内容而不用再在数据库里面搜索一次。
但是我遇到一个奇怪的问题,虽然sphinx能返回搜索到的结果,但是所有设置了sql_attr_string的字段返回的都是0而不是数据库里的内容。
请问是哪个地方出了问题呢?
Answers
String attributes can store arbitrary strings attached to every document. There's a fixed size limit of 4 MB per value. Also, searchd will currently cache all the values in RAM, which is an additional implicit limit.
As of 1.10-beta, strings can only be used for storage and retrieval. They can not participate in expressions, be used for filtering, sorting, or grouping (ie. in WHERE, ORDER or GROUP clauses). Note that attributes declared using sql_attr_string will not be full-text indexed; you can use sql_field_string directive for that.
出现结果为0,可以先用shell 调试下即bin/search 看看返回的结果是不是0。如果正确,则看下你用sphinxapi.php这个是不是旧的,也应该更新为新的。