J'ai besoin de rechercher des emplacements avec tri par distance des coordonnées passées.Problèmes de géosearch du sphinx de réflexion
app/indices/location_index.rb
ThinkingSphinx::Index.define :location, :with => :active_record do
indexes :name
has latitude, longitude
end
Essayez de recherche:
> 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'
- Sphinx 2.0.6 libération (r3473, 22 octobre 2012)
- thinking- sphinx (3.0.1)
Mise à jour:
Pat Allan suggéré: Geodist ne nécessite plus le symbole @ - essayez donc les suivantes au lieu:
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
Je ne sais pas assez à propos de think-sphinx pour vraiment aider. mais essayez peut-être d'ajouter 'compat_sphinxql_magics = 1 '(ou de changer la ligne existante de 0) dans votre fichier sphinx.conf. @geodist n'est pas supporté dans les interations ultérieures de sphinxql, il faut donc réactiver le mode hérité. – barryhunter
@barryhunter, ça n'a pas aidé. Mais merci! –