lib/estella/parser.rb in estella-0.3.0 vs lib/estella/parser.rb in estella-2.0.0
- old
+ new
@@ -6,12 +6,11 @@
# document level boost
# @see https://www.elastic.co/guide/en/elasticsearch/guide/current/boosting-by-popularity.html
def boost(name, opts = {})
fail ArgumentError, 'Boost field is not indexed!' unless @model.indexed_fields.include? name
- unless (opts.keys & [:modifier, :factor]).length == 2
- fail ArgumentError, 'Please supply a modifier and a factor for your boost!'
- end
+ fail ArgumentError, 'Please supply a modifier and a factor for your boost!' unless (opts.keys & %i[modifier factor]).length == 2
+
@model.field_boost = { boost: { field: name }.merge(opts) }
end
# index a field
def field(name, opts = {})