lib/flare/index_builder.rb in flare-1.1.0 vs lib/flare/index_builder.rb in flare-1.2.0

- old
+ new

@@ -2,23 +2,28 @@ class IndexBuilder attr_reader :fields def initialize(&block) @fields = [] + @attributes = {} self.instance_eval(&block) if block_given? end def index - { :fields => @fields } + { :fields => @fields, :attributes => @attributes } end protected def field(*args) field, options = args.first, args.extract_options! @fields << { :source => field, :name => options[:as] || field, :boost => options[:boost] || nil } + end + + def attribute(name, value) + @attributes[name] = value end end end