Class: Scripsi::SortedSuffixIndexer::Documents

Inherits:
Object
  • Object
show all
Defined in:
lib/scripsi.rb

Overview

a lazy list of documents associated with a SortedSuffixIndexer

Instance Method Summary collapse

Constructor Details

#initialize(doc_key, endpoints_key) ⇒ Documents

Returns a new instance of Documents.



96
97
98
99
# File 'lib/scripsi.rb', line 96

def initialize(doc_key, endpoints_key)
  @doc_key = doc_key
  @endpoints_key = endpoints_key
end

Instance Method Details

#[](id) ⇒ Object



101
102
103
104
105
106
# File 'lib/scripsi.rb', line 101

def [](id)
  endpoints = Scripsi.redis.hget(@endpoints_key, id)
  return nil unless endpoints
  a,b = Marshal.load(endpoints)
  Scripsi.redis.getrange @doc_key, a.to_i, b.to_i
end