lib/sunspot.rb in outoftime-sunspot-0.7.2 vs lib/sunspot.rb in outoftime-sunspot-0.7.3
- old
+ new
@@ -22,10 +22,12 @@
# method) is _not_ session-specific, but rather global.
#
module Sunspot
UnrecognizedFieldError = Class.new(Exception)
UnrecognizedRestrictionError = Class.new(Exception)
+ NoAdapterError = Class.new(Exception)
+ NoSetupError = Class.new(Exception)
class <<self
# Configures indexing and search for a given class.
#
# ==== Parameters
@@ -223,13 +225,25 @@
#
def remove(*objects)
session.remove(*objects)
end
+ #
+ # Remove objects from the index and immediately commit. See Sunspot.remove
+ #
+ # ==== Parameters
+ #
+ # objects...<Object>:: Objects to remove from the index
+ #
+ def remove!
+ session.remove!(*objects)
+ end
+
# Remove all objects of the given classes from the index. There isn't much
# use for this in general operations but it can be useful for maintenance,
- # testing, etc.
+ # testing, etc. If no arguments are passed, remove everything from the
+ # index.
#
# ==== Parameters
#
# classes...<Class>::
# classes for which to remove all instances from the index (may pass an
@@ -238,9 +252,21 @@
# ==== Example
#
# Sunspot.remove_all(Post, Blog)
#
def remove_all(*classes)
+ session.remove_all(*classes)
+ end
+
+ #
+ # Remove all objects of the given classes from the index and immediately
+ # commit. See Sunspot.remove_all
+ #
+ # ==== Parameters
+ #
+ # classes...<Class>::
+ # classes for which to remove all instances from the index
+ def remove_all!(*classes)
session.remove_all(*classes)
end
#
# True if documents have been added, updated, or removed since the last