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