Class: Redis::Commands::Search::SearchResult
- Inherits:
-
Object
- Object
- Redis::Commands::Search::SearchResult
- Includes:
- Enumerable
- Defined in:
- lib/redis/commands/modules/search/result.rb
Overview
Result of FT.SEARCH: the total number of matching documents (which may exceed the number returned because of paging) plus the documents on this page.
Instance Attribute Summary collapse
- #documents ⇒ Integer, ... readonly
- #total ⇒ Integer, ... readonly
- #warnings ⇒ Integer, ... readonly
Instance Method Summary collapse
-
#[](index) ⇒ Document?
The document at
index, or nil when out of range. -
#each {|document| ... } ⇒ Enumerator, Array<Document>
Iterate over the documents on this page.
-
#empty? ⇒ Boolean
Whether this page has no documents.
-
#initialize(total, documents, warnings: []) ⇒ SearchResult
constructor
A new instance of SearchResult.
-
#size ⇒ Integer
(also: #length)
The number of documents on this page.
Constructor Details
#initialize(total, documents, warnings: []) ⇒ SearchResult
Returns a new instance of SearchResult.
85 86 87 88 89 |
# File 'lib/redis/commands/modules/search/result.rb', line 85 def initialize(total, documents, warnings: []) @total = total @documents = documents @warnings = warnings end |
Instance Attribute Details
#documents ⇒ Integer, ... (readonly)
80 81 82 |
# File 'lib/redis/commands/modules/search/result.rb', line 80 def documents @documents end |
#total ⇒ Integer, ... (readonly)
80 81 82 |
# File 'lib/redis/commands/modules/search/result.rb', line 80 def total @total end |
#warnings ⇒ Integer, ... (readonly)
80 81 82 |
# File 'lib/redis/commands/modules/search/result.rb', line 80 def warnings @warnings end |
Instance Method Details
#[](index) ⇒ Document?
Returns the document at index, or nil when out of range.
101 102 103 |
# File 'lib/redis/commands/modules/search/result.rb', line 101 def [](index) @documents[index] end |
#each {|document| ... } ⇒ Enumerator, Array<Document>
Iterate over the documents on this page.
95 96 97 |
# File 'lib/redis/commands/modules/search/result.rb', line 95 def each(&block) @documents.each(&block) end |
#empty? ⇒ Boolean
Returns whether this page has no documents.
112 113 114 |
# File 'lib/redis/commands/modules/search/result.rb', line 112 def empty? @documents.empty? end |
#size ⇒ Integer Also known as: length
Returns the number of documents on this page.
106 107 108 |
# File 'lib/redis/commands/modules/search/result.rb', line 106 def size @documents.size end |