Class: Redis::Commands::Search::HybridResult
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
self,
Enumerable
|
|
| Inherits: | Object |
| Defined in: | lib/redis/commands/modules/search/result.rb |
Overview
Result of FT.HYBRID: the fused result rows (each a field => value hash, including the
synthetic "__key" and "__score") plus the total, any warnings and the execution time.
When the query used WITHCURSOR the server returns per-leg cursor ids instead of an inline page; those are exposed via #search_cursor / #vsim_cursor and #cursor? is true.
Class Method Summary
Instance Attribute Summary
- #cursor? ⇒ Boolean readonly
- #empty? ⇒ Boolean readonly
- #execution_time ⇒ Array<Hash{String => Object}>, ... readonly
- #rows ⇒ Array<Hash{String => Object}>, ... readonly
- #search_cursor ⇒ Array<Hash{String => Object}>, ... readonly
- #total ⇒ Array<Hash{String => Object}>, ... readonly
- #vsim_cursor ⇒ Array<Hash{String => Object}>, ... readonly
- #warnings ⇒ Array<Hash{String => Object}>, ... readonly
Instance Method Summary
- #[](index) ⇒ Hash?
-
#each {|row| ... } ⇒ Enumerator, Array<Hash>
Iterate over the result rows.
-
#length
Alias for #size.
- #size ⇒ Integer (also: #length)
Constructor Details
.new(rows: [], total: nil, warnings: [], execution_time: nil, search_cursor: nil, vsim_cursor: nil) ⇒ HybridResult
# File 'lib/redis/commands/modules/search/result.rb', line 177
def initialize(rows: [], total: nil, warnings: [], execution_time: nil, search_cursor: nil, vsim_cursor: nil) @rows = rows @total = total @warnings = warnings @execution_time = execution_time @search_cursor = search_cursor @vsim_cursor = vsim_cursor end
Instance Attribute Details
#cursor? ⇒ Boolean (readonly)
# File 'lib/redis/commands/modules/search/result.rb', line 213
def cursor? !@search_cursor.nil? || !@vsim_cursor.nil? end
#empty? ⇒ Boolean (readonly)
# File 'lib/redis/commands/modules/search/result.rb', line 208
def empty? @rows.empty? end
#execution_time ⇒ Array<Hash{String => Object}>, ... (readonly)
# File 'lib/redis/commands/modules/search/result.rb', line 175
attr_reader :rows, :total, :warnings, :execution_time, :search_cursor, :vsim_cursor
#rows ⇒ Array<Hash{String => Object}>, ... (readonly)
# File 'lib/redis/commands/modules/search/result.rb', line 175
attr_reader :rows, :total, :warnings, :execution_time, :search_cursor, :vsim_cursor
#search_cursor ⇒ Array<Hash{String => Object}>, ... (readonly)
# File 'lib/redis/commands/modules/search/result.rb', line 175
attr_reader :rows, :total, :warnings, :execution_time, :search_cursor, :vsim_cursor
#total ⇒ Array<Hash{String => Object}>, ... (readonly)
# File 'lib/redis/commands/modules/search/result.rb', line 175
attr_reader :rows, :total, :warnings, :execution_time, :search_cursor, :vsim_cursor
#vsim_cursor ⇒ Array<Hash{String => Object}>, ... (readonly)
# File 'lib/redis/commands/modules/search/result.rb', line 175
attr_reader :rows, :total, :warnings, :execution_time, :search_cursor, :vsim_cursor
#warnings ⇒ Array<Hash{String => Object}>, ... (readonly)
# File 'lib/redis/commands/modules/search/result.rb', line 175
attr_reader :rows, :total, :warnings, :execution_time, :search_cursor, :vsim_cursor
Instance Method Details
#[](index) ⇒ Hash?
# File 'lib/redis/commands/modules/search/result.rb', line 197
def [](index) @rows[index] end
#each {|row| ... } ⇒ Enumerator, Array<Hash>
Iterate over the result rows.
# File 'lib/redis/commands/modules/search/result.rb', line 191
def each(&block) @rows.each(&block) end
#length
Alias for #size.
# File 'lib/redis/commands/modules/search/result.rb', line 205
alias length size
#size ⇒ Integer
Also known as: #length
# File 'lib/redis/commands/modules/search/result.rb', line 202
def size @rows.size end