lib/sunspot/dsl/fields.rb in sunspot-0.9.8 vs lib/sunspot/dsl/fields.rb in sunspot-0.10.0
- old
+ new
@@ -24,20 +24,33 @@
# names...<Symbol>:: One or more field names
#
# ==== Options
#
# :boost<Float>::
- # Boost that should be applied to this field for keyword search
+ # Index-time boost that should be applied to this field for keyword search
+ # :default_boost<Float>::
+ # Default search-time boost to apply to this field during keyword
+ # search. Can be overriden with DSL::Fulltext#fields or
+ # DSL::Fulltext#boost_fields method.
#
def text(*names, &block)
options = names.pop if names.last.is_a?(Hash)
for name in names
@setup.add_text_field_factory(
name,
options || {},
&block
)
end
+ end
+
+ #
+ # Specify a method that returns the geographical coordinates associated
+ # with the document. The object returned must respond to #first and #last
+ # (e.g., a two-element Array); or to #lat and one of #lng, #lon, or #long
+ #
+ def coordinates(name)
+ @setup.set_coordinates_field(name)
end
#
# Specify a document-level boost. As with fields, you have the option of
# passing an attribute name which will be called on each model, or a block