Class: Stretchy::Boosts::RandomBoost
- Defined in:
- lib/stretchy/boosts/random_boost.rb
Constant Summary collapse
- DEFAULT_WEIGHT =
1.2
Constants included from Utils::Contract
Utils::Contract::ASSERTIONS, Utils::Contract::DISTANCE_FORMAT
Instance Method Summary collapse
-
#initialize(seed, weight = DEFAULT_WEIGHT) ⇒ RandomBoost
constructor
randomizes order (somewhat) consistently per-user www.elastic.co/guide/en/elasticsearch/guide/current/random-scoring.html.
- #to_search ⇒ Object
Methods included from Utils::Contract
Constructor Details
#initialize(seed, weight = DEFAULT_WEIGHT) ⇒ RandomBoost
randomizes order (somewhat) consistently per-user www.elastic.co/guide/en/elasticsearch/guide/current/random-scoring.html
13 14 15 16 17 |
# File 'lib/stretchy/boosts/random_boost.rb', line 13 def initialize(seed, weight = DEFAULT_WEIGHT) @seed = seed @weight = weight validate! end |
Instance Method Details
#to_search ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/stretchy/boosts/random_boost.rb', line 19 def to_search { random_score: { seed: @seed }, weight: @weight } end |