Sha256: db9ed29e33a209dcd87168c04a1d3045bc8e1635539cf73d0c477a8321c19058

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

module Riak
  class Client
    def create_search_index(name, schema=nil, n_val=nil)
      raise ArgumentError, t("zero_length_index") if name.nil? || name.empty?
      backend do |b|
        b.create_search_index(name, schema, n_val)
      end
      true
    end

    def get_search_index(name)
      raise ArgumentError, t("zero_length_index") if name.nil? || name.empty?
      resp = []
      backend do |b|
        resp = b.get_search_index(name)
      end
      resp.index && Array === resp.index ? resp.index.first : resp
    end

    def list_search_indexes()
      resp = []
      backend do |b|
        resp = b.get_search_index(nil)
      end
      resp.index ? resp.index : resp
    end

    def delete_search_index(name)
      raise ArgumentError, t("zero_length_index") if name.nil? || name.empty?
      backend do |b|
        b.delete_search_index(name)
      end
      true
    end

    def create_search_schema(name, content)
      raise ArgumentError, t("zero_length_schema") if name.nil? || name.empty?
      raise ArgumentError, t("zero_length_content") if content.nil? || content.empty?
      backend do |b|
        b.create_search_schema(name, content)
      end
      true
    end

    def get_search_schema(name)
      raise ArgumentError, t("zero_length_schema") if name.nil? || name.empty?
      backend do |b|
        return b.get_search_schema(name)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
riak-client-2.2.0.pre1 lib/riak/client/yokozuna.rb
riak-client-2.1.0 lib/riak/client/yokozuna.rb
riak-client-2.0.0 lib/riak/client/yokozuna.rb
riak-client-2.0.0.rc2 lib/riak/client/yokozuna.rb
riak-client-2.0.0.rc1 lib/riak/client/yokozuna.rb