Class: Stretchy::Boosts::RandomBoost
- Defined in:
- lib/stretchy/boosts/random_boost.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(seed, weight = nil) ⇒ RandomBoost
constructor
randomizes order (somewhat) consistently per-user http://www.elastic.co/guide/en/elasticsearch/guide/current/random-scoring.html.
- #to_search ⇒ Object
Methods included from Utils::Validation
#errors, included, #json_attributes, #require_one!, #require_only_one!, #valid?, #validate!, #validator
Constructor Details
#initialize(seed, weight = nil) ⇒ RandomBoost
randomizes order (somewhat) consistently per-user http://www.elastic.co/guide/en/elasticsearch/guide/current/random-scoring.html
18 19 20 21 22 |
# File 'lib/stretchy/boosts/random_boost.rb', line 18 def initialize(seed, weight = nil) @seed = seed @weight = weight || DEFAULT_WEIGHT validate! end |
Instance Method Details
#to_search ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/stretchy/boosts/random_boost.rb', line 24 def to_search { random_score: { seed: @seed }, weight: @weight } end |