README.rdoc in supernova-0.1.0 vs README.rdoc in supernova-0.1.1

- old
+ new

@@ -1,44 +1,49 @@ = supernova == Setup -require "supernova" -require "supernova/thiking_sphinx" + require "supernova" + require "supernova/thinking_sphinx" + + class Offer + include Supernova::ThinkingSphinx + end -class class Offer - include Supernova::ThinkingSphinx -end - === Anonymous Scopes -scope = Offer.order("popularity desc").with(:city => "Hamburg").paginate(:page => 2, :per_page => 10) + scope = Offer.order("popularity desc").with(:city => "Hamburg").paginate(:page => 2, :per_page => 10) + + # no query sent yet + # query is sent e.g. when + + scope.each { |offer| puts offer.city } # objects of current page are iterated + scope.total_entries # no objects loaded though + scope.ids # no objects loaded, only ids are returned + scope.first or scope.last # all objects are loaded, only first or last in "page" is returned -# no query sent yet -# query is sent e.g. when - -scope.each { |offer| puts offer.city } # objects of current page are iterated -scope.total_entries # no objects loaded though -scope.ids # no objects loaded, only ids are returned -scope.first or scope.last # all objects are loaded, only first or last in "page" is returned - === Named Scopes -class Offer - include Supernova::ThinkingSphinx - - named_search_scope :popular do - order("popularity desc") + class Offer + include Supernova::ThinkingSphinx + + named_search_scope :popular do + order("popularity desc") + end + + named_search_scope :for_artists do |ids| + with(:artist_id => ids) + end end - named_search_scope :for_artists do |ids| - with(:artist_id => ids) - end -end + Offer.popular.for_artists([1, 2, 3]) # various named scopes can be combined + Offer.popular.for_artists([1, 2, 3]).with(:available => true) # named scopes can also be combined with anonymous scopes -Offer.popular.for_artists([1, 2, 3]) # various named scopes can be combined -Offer.popular.for_artists([1, 2, 3]).with(:available => true) # named scopes can also be combined with anonymous scopes +=== Geo Searches + Offer.search_scope.near(47.0, 11.0).within(1.kms) + Offer.search_scope.near(47.0, 11.0).within(100.meters) + Offer.search_scope.near(other_offer).within(100.meters) == Contributing to search_scopes * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it @@ -48,8 +53,8 @@ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally. * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it. == Copyright -Copyright (c) 2011 Tobias Schwab. See LICENSE.txt for +Copyright (c) 2011 Dynport GmbH. See LICENSE.txt for further details.