2014-02-14 78 views
0

I''m與獅身人面像2.2.2.INDEX表JSON功能工作的樣子:Sphinxsearch的JSON值比較

mysql> SELECT subsite_min_cnt, version_content_cnt FROM mobile_collection; 
+------------------------+-----------------------------------------------------------+ 
| subsite_min_cnt  | version_content_cnt          | 
+------------------------+-----------------------------------------------------------+ 
| {"85":3,"75":4,"65":5} | {"10003":4,"10008":5,"10009":5,"11000":7,"1":1,"10000":3} | 
| {"85":6,"75":4,"65":5} | {"46":1,"201":1,"11000":1,"10010":1}      | 
+------------------------+-----------------------------------------------------------+ 

,我和兩個值從工作JSONs:

mysql> SELECT subsite_min_cnt.85 as a, version_content_cnt.10008 as b 
     FROM mobile_collection; 
+------+------+ 
| a | b | 
+------+------+ 
| 3 | 5 | 
| 6 | NULL | 
+------+------+ 

我嘗試比較這兩個值,這裏是我所得到的(該json_autoconv_numbers等於1):

mysql> SELECT subsite_min_cnt.85 as a, version_content_cnt.10008 as b 
     FROM mobile_collection WHERE b IS NOT NULL and a < b; 

ERROR 1064 (42000): sphinxql: syntax error, unexpected IDENT, expecting CONST_INT (or 3 other tokens) near 'b' 

或者:

mysql> SELECT subsite_min_cnt.85 < version_content_cnt.10008 as b 
     FROM mobile_collection; 
+------+ 
| b | 
+------+ 
| 0 | 
| 0 | 
+------+ 

所以,問題是:比較兩個json值在sphinxql中工作嗎?或者,也許,我比較項目在錯誤的方式...

回答

0

儘管json_autoconv_numbers = 1,類型轉換解決我的問題:

mysql> SELECT integer(subsite_min_cnt.85) < integer(version_content_cnt.10008) as c, subsite_min_cnt.85, version_content_cnt.10008 
     FROM mobile_collection where c > 0; 
+------+--------------------+---------------------------+ 
| c | subsite_min_cnt.85 | version_content_cnt.10008 | 
+------+--------------------+---------------------------+ 
| 1 | 3     | 5       | 
+------+--------------------+---------------------------+