Class: Jubatus::NearestNeighbor::Client::NearestNeighbor

Inherits:
Common::ClientBase show all
Includes:
Common
Defined in:
lib/jubatus/nearest_neighbor/client.rb

Instance Method Summary collapse

Methods included from Common

check_type, check_types

Methods inherited from Common::ClientBase

connect, #do_mix, #get_client, #get_config, #get_name, #get_proxy_status, #get_status, #load, #save, #set_name

Constructor Details

#initialize(host, port, name, timeout_sec = 10) ⇒ NearestNeighbor

Returns a new instance of NearestNeighbor.



16
17
18
# File 'lib/jubatus/nearest_neighbor/client.rb', line 16

def initialize(host, port, name, timeout_sec=10)
  super
end

Instance Method Details

#clearObject



20
21
22
# File 'lib/jubatus/nearest_neighbor/client.rb', line 20

def clear
  @jubatus_client.call("clear", [], TBool.new, [])
end

#neighbor_row_from_datum(query, size) ⇒ Object



34
35
36
37
# File 'lib/jubatus/nearest_neighbor/client.rb', line 34

def neighbor_row_from_datum(query, size)
  @jubatus_client.call("neighbor_row_from_datum", [query, size], TList.new(
      TUserDef.new(IdWithScore)), [TDatum.new, TInt.new(false, 4)])
end

#neighbor_row_from_id(id, size) ⇒ Object



29
30
31
32
# File 'lib/jubatus/nearest_neighbor/client.rb', line 29

def neighbor_row_from_id(id, size)
  @jubatus_client.call("neighbor_row_from_id", [id, size], TList.new(
      TUserDef.new(IdWithScore)), [TString.new, TInt.new(false, 4)])
end

#set_row(id, d) ⇒ Object



24
25
26
27
# File 'lib/jubatus/nearest_neighbor/client.rb', line 24

def set_row(id, d)
  @jubatus_client.call("set_row", [id, d], TBool.new, [TString.new,
      TDatum.new])
end

#similar_row_from_datum(query, ret_num) ⇒ Object



44
45
46
47
# File 'lib/jubatus/nearest_neighbor/client.rb', line 44

def similar_row_from_datum(query, ret_num)
  @jubatus_client.call("similar_row_from_datum", [query, ret_num], TList.new(
      TUserDef.new(IdWithScore)), [TDatum.new, TInt.new(true, 4)])
end

#similar_row_from_id(id, ret_num) ⇒ Object



39
40
41
42
# File 'lib/jubatus/nearest_neighbor/client.rb', line 39

def similar_row_from_id(id, ret_num)
  @jubatus_client.call("similar_row_from_id", [id, ret_num], TList.new(
      TUserDef.new(IdWithScore)), [TString.new, TInt.new(true, 4)])
end