Skip to content

Commit

Permalink
Remove :distance special sort
Browse files Browse the repository at this point in the history
This is no longer the way to order by distance in geo searches; should
fail fast.

[sunspot#85 state:resolved]
  • Loading branch information
Mat Brown committed Mar 8, 2010
1 parent 1ac3d1a commit b30f3df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 0 additions & 10 deletions sunspot/lib/sunspot/query/sort.rb
Expand Up @@ -90,16 +90,6 @@ def to_param
"score #{direction_for_solr}"
end
end

#
# A DistanceSort sorts by distance from the origin coordinates of a
# geographical distance search.
#
class DistanceSort < Abstract
def to_param
"geo_distance #{direction_for_solr}"
end
end
end
end
end
8 changes: 8 additions & 0 deletions sunspot/spec/api/query/ordering_pagination_spec.rb
Expand Up @@ -71,6 +71,14 @@
end.should raise_error(ArgumentError)
end

it 'throws an UnrecognizedFieldError if :distance is given for sort' do
lambda do
session.search Post do
order_by :distance, :asc
end
end.should raise_error(Sunspot::UnrecognizedFieldError)
end

it 'does not allow ordering by multiple-value fields' do
lambda do
session.search Post do
Expand Down

0 comments on commit b30f3df

Please sign in to comment.