def ensure_reader_open(get_latest = true)
        raise "tried to use a closed index" if not @open
        if @reader
          if get_latest
            latest = false
            begin
              latest = @reader.latest?
            rescue Lock::LockError
              sleep(@options[:lock_retry_time]) # sleep for 2 seconds and try again
              latest = @reader.latest?
            end
            if not latest
              @searcher.close if @searcher
              @reader.close
              return @reader = IndexReader.new(@dir)
            end
          end
        else
          if @writer
            @writer.close
            @writer = nil
          end
          return @reader = IndexReader.new(@dir)
        end
        return false
      end
def ensure_reader_open(get_latest = true)
        raise "tried to use a closed index" if not @open
        if @reader
          if get_latest
            latest = false
            begin
              latest = @reader.latest?
            rescue Lock::LockError
              sleep(@options[:lock_retry_time]) # sleep for 2 seconds and try again
              latest = @reader.latest?
            end
            if not latest
              @searcher.close if @searcher
              @reader.close
              return @reader = IndexReader.new(@dir)
            end
          end
        else
          if @writer
            @writer.close
            @writer = nil
          end
          return @reader = IndexReader.new(@dir)
        end
        return false
      end
returns the new reader if one is opened