Class: Redis::Commands::Search::HybridSearchQuery
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | lib/redis/commands/modules/search/hybrid.rb |
Overview
The textual SEARCH leg of an FT.HYBRID query.
Chainable setters (+scorer+, #yield_score_as) return self; #args renders the leg
into its argument tokens, beginning with "SEARCH".
Class Method Summary
Instance Attribute Summary
- #query_string ⇒ String readonly
Instance Method Summary
- #args ⇒ Array
-
#scorer(scorer) ⇒ self
Set the scoring function (+SCORER+).
-
#yield_score_as(alias_name) ⇒ self
Expose the search score under an alias (+YIELD_SCORE_AS+).
Constructor Details
.new(query_string, scorer: nil, yield_score_as: nil) ⇒ HybridSearchQuery
# File 'lib/redis/commands/modules/search/hybrid.rb', line 17
def initialize(query_string, scorer: nil, yield_score_as: nil) @query_string = query_string @scorer = scorer @yield_score_as = yield_score_as end
Instance Attribute Details
#query_string ⇒ String (readonly)
# File 'lib/redis/commands/modules/search/hybrid.rb', line 12
attr_reader :query_string
Instance Method Details
#args ⇒ Array
# File 'lib/redis/commands/modules/search/hybrid.rb', line 42
def args result = ["SEARCH", @query_string] result << "SCORER" << @scorer if @scorer result << "YIELD_SCORE_AS" << @yield_score_as if @yield_score_as result end
#scorer(scorer) ⇒ self
Set the scoring function (+SCORER+).
# File 'lib/redis/commands/modules/search/hybrid.rb', line 27
def scorer(scorer) @scorer = scorer self end
#yield_score_as(alias_name) ⇒ self
Expose the search score under an alias (+YIELD_SCORE_AS+).
# File 'lib/redis/commands/modules/search/hybrid.rb', line 36
def yield_score_as(alias_name) @yield_score_as = alias_name self end