9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/sunspot/dsl/more_like_this_query.rb', line 9
def fields(*field_names)
boosted_fields = field_names.pop if field_names.last.is_a?(Hash)
field_names.each do |name|
mlt_fields = @setup.more_like_this_fields(name)
raise(ArgumentError, "Field #{name} is not setup for more_like_this") if mlt_fields.empty?
mlt_fields.each { |field| @query.more_like_this.add_field(field) }
end
if boosted_fields
boosted_fields.each_pair do |field_name, boost|
@setup.more_like_this_fields(field_name).each do |field|
@query.more_like_this.add_field(field, boost)
end
end
end
end
|