Class: Redis::Commands::Search::HybridSearchQuery
- Inherits:
-
Object
- Object
- Redis::Commands::Search::HybridSearchQuery
- 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".
Instance Attribute Summary collapse
-
#query_string ⇒ String
readonly
The search query string.
Instance Method Summary collapse
-
#args ⇒ Array
The
SEARCHleg argument tokens, beginning with "SEARCH". -
#initialize(query_string, scorer: nil, yield_score_as: nil) ⇒ HybridSearchQuery
constructor
A new instance of HybridSearchQuery.
-
#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
#initialize(query_string, scorer: nil, yield_score_as: nil) ⇒ HybridSearchQuery
Returns a new instance of HybridSearchQuery.
17 18 19 20 21 |
# 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)
Returns the search query string.
12 13 14 |
# File 'lib/redis/commands/modules/search/hybrid.rb', line 12 def query_string @query_string end |
Instance Method Details
#args ⇒ Array
Returns the SEARCH leg argument tokens, beginning with "SEARCH".
42 43 44 45 46 47 |
# 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+).
27 28 29 30 |
# 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+).
36 37 38 39 |
# File 'lib/redis/commands/modules/search/hybrid.rb', line 36 def yield_score_as(alias_name) @yield_score_as = alias_name self end |