Sphinx -------------------------
开始是使用 sql_attr_string = name 因为我希望 sphinx 在搜索出来结果后把 name 返回给我,但是发现搜索全名的适合却搜不出结果。比如 一个商品的全名为 "PEPSI COLA 20OZ",当搜索‘PEPSI COLA’的时候商品可以被搜索出来,搜索‘PEPSI COLA 20OZ’时却没有结果。
查看文档得知
http://sphinxsearch.com/docs/current.html#conf-sql-attr-string
String attribute declaration. Multi-value (ie. there may be more than one such attribute declared), optional. Applies to SQL source types (mysql, pgsql, mssql) only. Introduced in version 1.10-beta. 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. Starting from 2.0.1-beta string attributes can be used for sorting and grouping(ORDER BY, GROUP BY, WITHIN GROUP ORDER BY). Note that attributes declared using sql_attr_string will not be full-text indexed; you can use sql_field_string directive for that.
所以把 sql_attr_string 换成 sql_field_string 问题完美解决,搜索‘PEPSI COLA 20OZ’也出了想要的结果。