Sha256: 2ad59d2128c588a94ade1352b12cc0f92f1ba9e2e12b5d710d0c53d04761bc79

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

module Khoj
  module Index

    def create_index
      response = @conn.put("/#{_index}")
      response.code == 200 ? true : (raise KhojException.new(response.parsed_response))
    end

    def delete_index
      response = @conn.delete("/#{_index}")
      response.code == 200 ? true : (raise KhojException.new(response.parsed_response))
    end

    def index?
      @conn.head("/#{_index}").code == 200 ? true : false 
    end

    def index_stats
      response = @conn.get("/#{_index }/_stats")
      if response.code == 200
        response.parsed_response['_all']['total']['docs']['count']
      else
        raise KhojException.new(response.parsed_response) 
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
khoj-0.0.1 lib/khoj/index.rb