# File lib/fastri/full_text_index.rb, line 136
  def fetch_data(index, size, offset = 0)
    raise "Bad offset" unless offset <= 0
    get_fulltext_IO do |fulltextIO|
      get_sarray_IO do |sarrayIO|
        base = index_to_offset(sarrayIO, index)
        actual_offset = offset
        newsize = size
        if base + offset < 0    # at the beginning
          excess        = (base + offset).abs   # remember offset is < 0
          newsize       = size - excess
          actual_offset = offset + excess
        end
        str  = get_string(sarrayIO, fulltextIO, index, newsize, offset)
        from = (str.rindex("\0", -actual_offset) || -1) + 1
        to   = (str.index("\0", -actual_offset) || 0) - 1
        str[from..to]
      end
    end
  end