class RediSearch::Document::Finder
Attributes
document_id[R]
index[R]
Public Class Methods
new(index, document_id)
click to toggle source
# File lib/redi_search/document/finder.rb, line 6 def initialize(index, document_id) @index = index @document_id = document_id end
Public Instance Methods
find()
click to toggle source
# File lib/redi_search/document/finder.rb, line 11 def find Document.new(index, document_id, Hash[*response]) if response? end
Private Instance Methods
call!(*command)
click to toggle source
# File lib/redi_search/document/finder.rb, line 23 def call!(*command) RediSearch.client.call!(*command, skip_ft: true) end
prepended_document_id()
click to toggle source
# File lib/redi_search/document/finder.rb, line 27 def prepended_document_id if document_id.to_s.start_with? index.name document_id else "#{index.name}#{document_id}" end end
response()
click to toggle source
# File lib/redi_search/document/finder.rb, line 19 def response @response ||= call!("HGETALL", prepended_document_id) end
response?()
click to toggle source
# File lib/redi_search/document/finder.rb, line 35 def response? !response.to_a.empty? end