relevanced_client 0.9.0rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/gen-rb/relevanced.rb +1120 -0
- data/lib/gen-rb/relevanced_protocol_constants.rb +9 -0
- data/lib/gen-rb/relevanced_protocol_types.rb +482 -0
- data/lib/relevanced_client.rb +101 -0
- metadata +67 -0
@@ -0,0 +1,482 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift Compiler (0.9.0)
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
|
9
|
+
class WordVectorDTO
|
10
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
11
|
+
MAGNITUDE = 1
|
12
|
+
DOCUMENTWEIGHT = 2
|
13
|
+
SCORES = 3
|
14
|
+
|
15
|
+
FIELDS = {
|
16
|
+
MAGNITUDE => {:type => ::Thrift::Types::DOUBLE, :name => 'magnitude'},
|
17
|
+
DOCUMENTWEIGHT => {:type => ::Thrift::Types::DOUBLE, :name => 'documentWeight'},
|
18
|
+
SCORES => {:type => ::Thrift::Types::MAP, :name => 'scores', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::DOUBLE}}
|
19
|
+
}
|
20
|
+
|
21
|
+
def struct_fields; FIELDS; end
|
22
|
+
|
23
|
+
def validate
|
24
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field magnitude is unset!') unless @magnitude
|
25
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field documentWeight is unset!') unless @documentWeight
|
26
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field scores is unset!') unless @scores
|
27
|
+
end
|
28
|
+
|
29
|
+
::Thrift::Struct.generate_accessors self
|
30
|
+
end
|
31
|
+
|
32
|
+
class CentroidMetadataDTO
|
33
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
34
|
+
ID = 1
|
35
|
+
CREATED = 2
|
36
|
+
LASTDOCUMENTCHANGE = 3
|
37
|
+
LASTCALCULATED = 4
|
38
|
+
|
39
|
+
FIELDS = {
|
40
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
41
|
+
CREATED => {:type => ::Thrift::Types::I64, :name => 'created'},
|
42
|
+
LASTDOCUMENTCHANGE => {:type => ::Thrift::Types::I64, :name => 'lastDocumentChange'},
|
43
|
+
LASTCALCULATED => {:type => ::Thrift::Types::I64, :name => 'lastCalculated'}
|
44
|
+
}
|
45
|
+
|
46
|
+
def struct_fields; FIELDS; end
|
47
|
+
|
48
|
+
def validate
|
49
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
50
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field created is unset!') unless @created
|
51
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field lastDocumentChange is unset!') unless @lastDocumentChange
|
52
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field lastCalculated is unset!') unless @lastCalculated
|
53
|
+
end
|
54
|
+
|
55
|
+
::Thrift::Struct.generate_accessors self
|
56
|
+
end
|
57
|
+
|
58
|
+
class CentroidDTO
|
59
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
60
|
+
ID = 1
|
61
|
+
WORDVECTOR = 2
|
62
|
+
|
63
|
+
FIELDS = {
|
64
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
65
|
+
WORDVECTOR => {:type => ::Thrift::Types::STRUCT, :name => 'wordVector', :class => ::WordVectorDTO}
|
66
|
+
}
|
67
|
+
|
68
|
+
def struct_fields; FIELDS; end
|
69
|
+
|
70
|
+
def validate
|
71
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
72
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field wordVector is unset!') unless @wordVector
|
73
|
+
end
|
74
|
+
|
75
|
+
::Thrift::Struct.generate_accessors self
|
76
|
+
end
|
77
|
+
|
78
|
+
class ProcessedDocumentMetadataDTO
|
79
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
80
|
+
ID = 1
|
81
|
+
SHA1HASH = 2
|
82
|
+
CREATED = 3
|
83
|
+
UPDATED = 4
|
84
|
+
|
85
|
+
FIELDS = {
|
86
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
87
|
+
SHA1HASH => {:type => ::Thrift::Types::STRING, :name => 'sha1Hash'},
|
88
|
+
CREATED => {:type => ::Thrift::Types::I64, :name => 'created'},
|
89
|
+
UPDATED => {:type => ::Thrift::Types::I64, :name => 'updated'}
|
90
|
+
}
|
91
|
+
|
92
|
+
def struct_fields; FIELDS; end
|
93
|
+
|
94
|
+
def validate
|
95
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
96
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field sha1Hash is unset!') unless @sha1Hash
|
97
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field created is unset!') unless @created
|
98
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field updated is unset!') unless @updated
|
99
|
+
end
|
100
|
+
|
101
|
+
::Thrift::Struct.generate_accessors self
|
102
|
+
end
|
103
|
+
|
104
|
+
class ProcessedDocumentDTO
|
105
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
106
|
+
METADATA = 1
|
107
|
+
WORDVECTOR = 2
|
108
|
+
|
109
|
+
FIELDS = {
|
110
|
+
METADATA => {:type => ::Thrift::Types::STRUCT, :name => 'metadata', :class => ::ProcessedDocumentMetadataDTO},
|
111
|
+
WORDVECTOR => {:type => ::Thrift::Types::STRUCT, :name => 'wordVector', :class => ::WordVectorDTO}
|
112
|
+
}
|
113
|
+
|
114
|
+
def struct_fields; FIELDS; end
|
115
|
+
|
116
|
+
def validate
|
117
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field metadata is unset!') unless @metadata
|
118
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field wordVector is unset!') unless @wordVector
|
119
|
+
end
|
120
|
+
|
121
|
+
::Thrift::Struct.generate_accessors self
|
122
|
+
end
|
123
|
+
|
124
|
+
class GetDocumentMetadataResponse
|
125
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
126
|
+
METADATA = 1
|
127
|
+
|
128
|
+
FIELDS = {
|
129
|
+
METADATA => {:type => ::Thrift::Types::STRUCT, :name => 'metadata', :class => ::ProcessedDocumentMetadataDTO}
|
130
|
+
}
|
131
|
+
|
132
|
+
def struct_fields; FIELDS; end
|
133
|
+
|
134
|
+
def validate
|
135
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field metadata is unset!') unless @metadata
|
136
|
+
end
|
137
|
+
|
138
|
+
::Thrift::Struct.generate_accessors self
|
139
|
+
end
|
140
|
+
|
141
|
+
class GetFullDocumentResponse
|
142
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
143
|
+
DOCUMENT = 1
|
144
|
+
|
145
|
+
FIELDS = {
|
146
|
+
DOCUMENT => {:type => ::Thrift::Types::STRUCT, :name => 'document', :class => ::ProcessedDocumentDTO}
|
147
|
+
}
|
148
|
+
|
149
|
+
def struct_fields; FIELDS; end
|
150
|
+
|
151
|
+
def validate
|
152
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field document is unset!') unless @document
|
153
|
+
end
|
154
|
+
|
155
|
+
::Thrift::Struct.generate_accessors self
|
156
|
+
end
|
157
|
+
|
158
|
+
class GetCentroidMetadataResponse
|
159
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
160
|
+
METADATA = 1
|
161
|
+
|
162
|
+
FIELDS = {
|
163
|
+
METADATA => {:type => ::Thrift::Types::STRUCT, :name => 'metadata', :class => ::CentroidMetadataDTO}
|
164
|
+
}
|
165
|
+
|
166
|
+
def struct_fields; FIELDS; end
|
167
|
+
|
168
|
+
def validate
|
169
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field metadata is unset!') unless @metadata
|
170
|
+
end
|
171
|
+
|
172
|
+
::Thrift::Struct.generate_accessors self
|
173
|
+
end
|
174
|
+
|
175
|
+
class MultiSimilarityResponse
|
176
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
177
|
+
SCORES = 1
|
178
|
+
|
179
|
+
FIELDS = {
|
180
|
+
SCORES => {:type => ::Thrift::Types::MAP, :name => 'scores', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::DOUBLE}}
|
181
|
+
}
|
182
|
+
|
183
|
+
def struct_fields; FIELDS; end
|
184
|
+
|
185
|
+
def validate
|
186
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field scores is unset!') unless @scores
|
187
|
+
end
|
188
|
+
|
189
|
+
::Thrift::Struct.generate_accessors self
|
190
|
+
end
|
191
|
+
|
192
|
+
class ListCentroidDocumentsResponse
|
193
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
194
|
+
DOCUMENTS = 1
|
195
|
+
|
196
|
+
FIELDS = {
|
197
|
+
DOCUMENTS => {:type => ::Thrift::Types::LIST, :name => 'documents', :element => {:type => ::Thrift::Types::STRING}}
|
198
|
+
}
|
199
|
+
|
200
|
+
def struct_fields; FIELDS; end
|
201
|
+
|
202
|
+
def validate
|
203
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field documents is unset!') unless @documents
|
204
|
+
end
|
205
|
+
|
206
|
+
::Thrift::Struct.generate_accessors self
|
207
|
+
end
|
208
|
+
|
209
|
+
class ListDocumentsResponse
|
210
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
211
|
+
DOCUMENTS = 1
|
212
|
+
|
213
|
+
FIELDS = {
|
214
|
+
DOCUMENTS => {:type => ::Thrift::Types::LIST, :name => 'documents', :element => {:type => ::Thrift::Types::STRING}}
|
215
|
+
}
|
216
|
+
|
217
|
+
def struct_fields; FIELDS; end
|
218
|
+
|
219
|
+
def validate
|
220
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field documents is unset!') unless @documents
|
221
|
+
end
|
222
|
+
|
223
|
+
::Thrift::Struct.generate_accessors self
|
224
|
+
end
|
225
|
+
|
226
|
+
class ListCentroidsResponse
|
227
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
228
|
+
CENTROIDS = 1
|
229
|
+
|
230
|
+
FIELDS = {
|
231
|
+
CENTROIDS => {:type => ::Thrift::Types::LIST, :name => 'centroids', :element => {:type => ::Thrift::Types::STRING}}
|
232
|
+
}
|
233
|
+
|
234
|
+
def struct_fields; FIELDS; end
|
235
|
+
|
236
|
+
def validate
|
237
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field centroids is unset!') unless @centroids
|
238
|
+
end
|
239
|
+
|
240
|
+
::Thrift::Struct.generate_accessors self
|
241
|
+
end
|
242
|
+
|
243
|
+
class CreateDocumentResponse
|
244
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
245
|
+
ID = 1
|
246
|
+
|
247
|
+
FIELDS = {
|
248
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'}
|
249
|
+
}
|
250
|
+
|
251
|
+
def struct_fields; FIELDS; end
|
252
|
+
|
253
|
+
def validate
|
254
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
255
|
+
end
|
256
|
+
|
257
|
+
::Thrift::Struct.generate_accessors self
|
258
|
+
end
|
259
|
+
|
260
|
+
class DeleteDocumentResponse
|
261
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
262
|
+
ID = 1
|
263
|
+
|
264
|
+
FIELDS = {
|
265
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'}
|
266
|
+
}
|
267
|
+
|
268
|
+
def struct_fields; FIELDS; end
|
269
|
+
|
270
|
+
def validate
|
271
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
272
|
+
end
|
273
|
+
|
274
|
+
::Thrift::Struct.generate_accessors self
|
275
|
+
end
|
276
|
+
|
277
|
+
class CreateCentroidResponse
|
278
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
279
|
+
ID = 1
|
280
|
+
|
281
|
+
FIELDS = {
|
282
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'}
|
283
|
+
}
|
284
|
+
|
285
|
+
def struct_fields; FIELDS; end
|
286
|
+
|
287
|
+
def validate
|
288
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
289
|
+
end
|
290
|
+
|
291
|
+
::Thrift::Struct.generate_accessors self
|
292
|
+
end
|
293
|
+
|
294
|
+
class DeleteCentroidResponse
|
295
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
296
|
+
ID = 1
|
297
|
+
|
298
|
+
FIELDS = {
|
299
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'}
|
300
|
+
}
|
301
|
+
|
302
|
+
def struct_fields; FIELDS; end
|
303
|
+
|
304
|
+
def validate
|
305
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
306
|
+
end
|
307
|
+
|
308
|
+
::Thrift::Struct.generate_accessors self
|
309
|
+
end
|
310
|
+
|
311
|
+
class AddDocumentToCentroidResponse
|
312
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
313
|
+
CENTROIDID = 1
|
314
|
+
DOCUMENTID = 2
|
315
|
+
|
316
|
+
FIELDS = {
|
317
|
+
CENTROIDID => {:type => ::Thrift::Types::STRING, :name => 'centroidId'},
|
318
|
+
DOCUMENTID => {:type => ::Thrift::Types::STRING, :name => 'documentId'}
|
319
|
+
}
|
320
|
+
|
321
|
+
def struct_fields; FIELDS; end
|
322
|
+
|
323
|
+
def validate
|
324
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field centroidId is unset!') unless @centroidId
|
325
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field documentId is unset!') unless @documentId
|
326
|
+
end
|
327
|
+
|
328
|
+
::Thrift::Struct.generate_accessors self
|
329
|
+
end
|
330
|
+
|
331
|
+
class RemoveDocumentFromCentroidResponse
|
332
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
333
|
+
CENTROIDID = 1
|
334
|
+
DOCUMENTID = 2
|
335
|
+
|
336
|
+
FIELDS = {
|
337
|
+
CENTROIDID => {:type => ::Thrift::Types::STRING, :name => 'centroidId'},
|
338
|
+
DOCUMENTID => {:type => ::Thrift::Types::STRING, :name => 'documentId'}
|
339
|
+
}
|
340
|
+
|
341
|
+
def struct_fields; FIELDS; end
|
342
|
+
|
343
|
+
def validate
|
344
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field centroidId is unset!') unless @centroidId
|
345
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field documentId is unset!') unless @documentId
|
346
|
+
end
|
347
|
+
|
348
|
+
::Thrift::Struct.generate_accessors self
|
349
|
+
end
|
350
|
+
|
351
|
+
class JoinCentroidResponse
|
352
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
353
|
+
ID = 1
|
354
|
+
RECALCULATED = 2
|
355
|
+
|
356
|
+
FIELDS = {
|
357
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
358
|
+
RECALCULATED => {:type => ::Thrift::Types::BOOL, :name => 'recalculated'}
|
359
|
+
}
|
360
|
+
|
361
|
+
def struct_fields; FIELDS; end
|
362
|
+
|
363
|
+
def validate
|
364
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id
|
365
|
+
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field recalculated is unset!') if @recalculated.nil?
|
366
|
+
end
|
367
|
+
|
368
|
+
::Thrift::Struct.generate_accessors self
|
369
|
+
end
|
370
|
+
|
371
|
+
class ECentroidDoesNotExist < ::Thrift::Exception
|
372
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
373
|
+
ID = 1
|
374
|
+
MESSAGE = 2
|
375
|
+
|
376
|
+
FIELDS = {
|
377
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
378
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
379
|
+
}
|
380
|
+
|
381
|
+
def struct_fields; FIELDS; end
|
382
|
+
|
383
|
+
def validate
|
384
|
+
end
|
385
|
+
|
386
|
+
::Thrift::Struct.generate_accessors self
|
387
|
+
end
|
388
|
+
|
389
|
+
class ECentroidAlreadyExists < ::Thrift::Exception
|
390
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
391
|
+
ID = 1
|
392
|
+
MESSAGE = 2
|
393
|
+
|
394
|
+
FIELDS = {
|
395
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
396
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
397
|
+
}
|
398
|
+
|
399
|
+
def struct_fields; FIELDS; end
|
400
|
+
|
401
|
+
def validate
|
402
|
+
end
|
403
|
+
|
404
|
+
::Thrift::Struct.generate_accessors self
|
405
|
+
end
|
406
|
+
|
407
|
+
class EDocumentDoesNotExist < ::Thrift::Exception
|
408
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
409
|
+
ID = 1
|
410
|
+
MESSAGE = 2
|
411
|
+
|
412
|
+
FIELDS = {
|
413
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
414
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
415
|
+
}
|
416
|
+
|
417
|
+
def struct_fields; FIELDS; end
|
418
|
+
|
419
|
+
def validate
|
420
|
+
end
|
421
|
+
|
422
|
+
::Thrift::Struct.generate_accessors self
|
423
|
+
end
|
424
|
+
|
425
|
+
class EDocumentAlreadyExists < ::Thrift::Exception
|
426
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
427
|
+
ID = 1
|
428
|
+
MESSAGE = 2
|
429
|
+
|
430
|
+
FIELDS = {
|
431
|
+
ID => {:type => ::Thrift::Types::STRING, :name => 'id'},
|
432
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
433
|
+
}
|
434
|
+
|
435
|
+
def struct_fields; FIELDS; end
|
436
|
+
|
437
|
+
def validate
|
438
|
+
end
|
439
|
+
|
440
|
+
::Thrift::Struct.generate_accessors self
|
441
|
+
end
|
442
|
+
|
443
|
+
class EDocumentNotInCentroid < ::Thrift::Exception
|
444
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
445
|
+
DOCUMENTID = 1
|
446
|
+
CENTROIDID = 2
|
447
|
+
MESSAGE = 3
|
448
|
+
|
449
|
+
FIELDS = {
|
450
|
+
DOCUMENTID => {:type => ::Thrift::Types::STRING, :name => 'documentId'},
|
451
|
+
CENTROIDID => {:type => ::Thrift::Types::STRING, :name => 'centroidId'},
|
452
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
453
|
+
}
|
454
|
+
|
455
|
+
def struct_fields; FIELDS; end
|
456
|
+
|
457
|
+
def validate
|
458
|
+
end
|
459
|
+
|
460
|
+
::Thrift::Struct.generate_accessors self
|
461
|
+
end
|
462
|
+
|
463
|
+
class EDocumentAlreadyInCentroid < ::Thrift::Exception
|
464
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
465
|
+
DOCUMENTID = 1
|
466
|
+
CENTROIDID = 2
|
467
|
+
MESSAGE = 3
|
468
|
+
|
469
|
+
FIELDS = {
|
470
|
+
DOCUMENTID => {:type => ::Thrift::Types::STRING, :name => 'documentId'},
|
471
|
+
CENTROIDID => {:type => ::Thrift::Types::STRING, :name => 'centroidId'},
|
472
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
473
|
+
}
|
474
|
+
|
475
|
+
def struct_fields; FIELDS; end
|
476
|
+
|
477
|
+
def validate
|
478
|
+
end
|
479
|
+
|
480
|
+
::Thrift::Struct.generate_accessors self
|
481
|
+
end
|
482
|
+
|
@@ -0,0 +1,101 @@
|
|
1
|
+
$:.push('gen-rb')
|
2
|
+
|
3
|
+
require 'thrift'
|
4
|
+
require File.join(File.dirname(__FILE__), 'gen-rb', 'relevanced')
|
5
|
+
|
6
|
+
module RelevancedClient
|
7
|
+
|
8
|
+
class Client
|
9
|
+
def initialize(host, port)
|
10
|
+
@host = host
|
11
|
+
@port = port
|
12
|
+
@thrift_transport = Thrift::BufferedTransport.new(
|
13
|
+
Thrift::Socket.new(host, port)
|
14
|
+
)
|
15
|
+
@thrift_protocol = Thrift::BinaryProtocol.new(
|
16
|
+
@thrift_transport
|
17
|
+
)
|
18
|
+
@thrift_client = Relevanced::Client.new(@thrift_protocol)
|
19
|
+
@thrift_transport.open()
|
20
|
+
end
|
21
|
+
|
22
|
+
def ping()
|
23
|
+
@thrift_client.ping()
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_server_metadata()
|
27
|
+
@thrift_client.getServerMetadata()
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_document_similarity(centroid_id, document_id)
|
31
|
+
@thrift_client.getDocumentSimilarity(centroid_id, document_id)
|
32
|
+
end
|
33
|
+
|
34
|
+
def multi_get_text_similarity(centroid_id_list, text)
|
35
|
+
@thrift_client.multiGetTextSimilarity(
|
36
|
+
centroid_id_list, text
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_text_similarity(centroid_id, text)
|
41
|
+
@thrift_client.getTextSimilarity(centroid_id, text)
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_centroid_similarity(centroid_1_id, centroid_2_id)
|
45
|
+
@thrift_client.getCentroidSimilarity(
|
46
|
+
centroid_1_id, centroid_2_id
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_document(text)
|
51
|
+
@thrift_client.createDocument(text)
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_document_with_id(document_id, text)
|
55
|
+
@thrift_client.createDocumentWithId(
|
56
|
+
document_id, text
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def delete_document(document_id)
|
61
|
+
@thrift_client.deleteDocument(document_id)
|
62
|
+
end
|
63
|
+
|
64
|
+
def create_centroid(centroid_id)
|
65
|
+
@thrift_client.createCentroid(centroid_id)
|
66
|
+
end
|
67
|
+
|
68
|
+
def delete_centroid(centroid_id)
|
69
|
+
@thrift_client.deleteCentroid(centroid_id)
|
70
|
+
end
|
71
|
+
|
72
|
+
def list_all_documents_for_centroid(centroid_id)
|
73
|
+
@thrift_client.listAllDocumentsForCentroid(centroid_id)
|
74
|
+
end
|
75
|
+
|
76
|
+
def add_document_to_centroid(centroid_id, document_id)
|
77
|
+
@thrift_client.addDocumentToCentroid(
|
78
|
+
centroid_id, document_id
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
def remove_document_from_centroid(centroid_id, document_id)
|
83
|
+
@thrift_client.removeDocumentFromCentroid(
|
84
|
+
centroid_id, document_id
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
88
|
+
def join_centroid(centroid_id)
|
89
|
+
@thrift_client.joinCentroid(centroid_id)
|
90
|
+
end
|
91
|
+
|
92
|
+
def list_all_centroids()
|
93
|
+
@thrift_client.listAllCentroids()
|
94
|
+
end
|
95
|
+
|
96
|
+
def list_all_documents()
|
97
|
+
@thrift_client.listAllDocuments()
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: relevanced_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0rc2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Ivey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thrift
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.3.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.9.3.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.9.3.0
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.3.0
|
33
|
+
description: Ruby client for relevanced-server
|
34
|
+
email: scott.ivey@gmail.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- lib/gen-rb/relevanced.rb
|
40
|
+
- lib/gen-rb/relevanced_protocol_constants.rb
|
41
|
+
- lib/gen-rb/relevanced_protocol_types.rb
|
42
|
+
- lib/relevanced_client.rb
|
43
|
+
homepage: http://www.relevanced.org
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.3.1
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.2.2
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: relevanced client
|
67
|
+
test_files: []
|