Class: Stretchy::Boosts::FieldDecayBoost
- Defined in:
- lib/stretchy/boosts/field_decay_boost.rb
Constant Summary collapse
- DEFAULT_DECAY_FN =
:gauss
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FieldDecayBoost
constructor
A new instance of FieldDecayBoost.
-
#to_search ⇒ Object
Methods included from Utils::Validation
#errors, included, #require_one!, #require_only_one!, #valid?, #validate!, #validator
Constructor Details
#initialize(options = {}) ⇒ FieldDecayBoost
Returns a new instance of FieldDecayBoost.
26 27 28 29 30 31 |
# File 'lib/stretchy/boosts/field_decay_boost.rb', line 26 def initialize( = {}) self.class.attribute_set.set(self, ) if set_default_attributes validate! end |
Instance Method Details
#to_search ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/stretchy/boosts/field_decay_boost.rb', line 33 def to_search json = {scale: @scale} if @origin.is_a?(Types::Base) json[:origin] = @origin.to_search else json[:origin] = @origin end json[:offset] = @offset if @offset json[:decay] = @decay_amount if @decay_amount { @decay => { @field => json }, weight: @weight } end |