0
我需要通過距傳遞座標的距離排序來搜索位置。思維獅身人面像地質問題
應用程序/索引/ location_index.rb
ThinkingSphinx::Index.define :location, :with => :active_record do
indexes :name
has latitude, longitude
end
嘗試搜索:
> Location.search(:geo => [53.348962, 83.777988], :order => "@geodist DESC").size
ThinkingSphinx::SyntaxError: sphinxql: syntax error, unexpected USERVAR, expecting IDENT (or 5 other tokens) near '@geodist DESC LIMIT 0, 20; SHOW META'
> Location.search(:geo => [53.348962, 83.777988],:with => {"@geodist" => 0.0..5000.0}, :order => "@geodist DESC").size
ThinkingSphinx::SphinxError: sphinxql: only >=, <=, and BETWEEN floating-point filter types are supported in this version near '@geodist BETWEEN 0.0 AND 5000.0 AND sphinx_deleted = 0 ORDER BY @geodist DESC LIMIT 0, 20; SHOW META'
- 斯芬克斯2.0.6釋放(r3473; 2012年10月22日)
- thinking-獅身人面像(3.0.1)
更新:
帕特艾倫建議: Geodist不再需要@符號 - 所以儘量不要使用以下:
Location.search(:geo => [53.348962, 83.777988], :order => "geodist DESC").size
Location.search(:geo => [53.348962, 83.777988],:with => {:geodist => 0.0..5000.0}, :order => "geodist DESC").size
我不知道有關思維獅身人面像的真正幫助。但也許嘗試添加'compat_sphinxql_magics = 1'(或將現有的行從0改爲)sphinx.conf文件。在以後的sphinxql交互中不支持@geodist,所以必須重新啓用傳統模式。 – barryhunter 2013-02-13 15:12:33
@barryhunter,它沒有幫助。但是謝謝你! – 2013-02-13 15:59:42