Class: IndexeaClient::SearchApi

Inherits:
Object
  • Object
show all
Defined in:
lib/indexea_client/api/search_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SearchApi

Returns a new instance of SearchApi.



16
17
18
# File 'lib/indexea_client/api/search_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/indexea_client/api/search_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#search_click(widget, action_id, doc_id, opts = {}) ⇒ BOOLEAN

搜索结果点击行为收集 该接口主要用于记录用户对搜索结果的点击行为

Parameters:

  • widget

    组件唯一标识

  • action_id

    对应搜索行为编号

  • doc_id

    对应索引中的内部记录编号

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

Returns:

  • (BOOLEAN)


28
29
30
31
# File 'lib/indexea_client/api/search_api.rb', line 28

def search_click(widget, action_id, doc_id, opts = {})
  data, _status_code, _headers = search_click_with_http_info(widget, action_id, doc_id, opts)
  data
end

#search_click_with_http_info(widget, action_id, doc_id, opts = {}) ⇒ Array<(BOOLEAN, Integer, Hash)>

搜索结果点击行为收集 该接口主要用于记录用户对搜索结果的点击行为

Parameters:

  • widget

    组件唯一标识

  • action_id

    对应搜索行为编号

  • doc_id

    对应索引中的内部记录编号

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

Returns:

  • (Array<(BOOLEAN, Integer, Hash)>)

    BOOLEAN data, response status code and response headers



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/indexea_client/api/search_api.rb', line 42

def search_click_with_http_info(widget, action_id, doc_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_click ...'
  end
  # verify the required parameter 'widget' is set
  if @api_client.config.client_side_validation && widget.nil?
    fail ArgumentError, "Missing the required parameter 'widget' when calling SearchApi.search_click"
  end
  # verify the required parameter 'action_id' is set
  if @api_client.config.client_side_validation && action_id.nil?
    fail ArgumentError, "Missing the required parameter 'action_id' when calling SearchApi.search_click"
  end
  # verify the required parameter 'doc_id' is set
  if @api_client.config.client_side_validation && doc_id.nil?
    fail ArgumentError, "Missing the required parameter 'doc_id' when calling SearchApi.search_click"
  end
  # resource path
  local_var_path = '/search/widget/{widget}/click'.sub('{' + 'widget' + '}', widget.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'action_id'] = action_id
  query_params[:'doc_id'] = doc_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'BOOLEAN' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_click\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_histories(widget, strategy, query, size, opts = {}) ⇒ Array<String>

获取当前搜索用户的最新搜索记录

Parameters:

  • widget

    组件唯一标识

  • strategy

    搜索记录策略

  • query

    指定关联查询的编号

  • size

    数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非公开的组件,需要组件作者授权

Returns:

  • (Array<String>)


104
105
106
107
# File 'lib/indexea_client/api/search_api.rb', line 104

def search_histories(widget, strategy, query, size, opts = {})
  data, _status_code, _headers = search_histories_with_http_info(widget, strategy, query, size, opts)
  data
end

#search_histories_with_http_info(widget, strategy, query, size, opts = {}) ⇒ Array<(Array<String>, Integer, Hash)>

获取当前搜索用户的最新搜索记录

Parameters:

  • widget

    组件唯一标识

  • strategy

    搜索记录策略

  • query

    指定关联查询的编号

  • size

    数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非公开的组件,需要组件作者授权

Returns:

  • (Array<(Array<String>, Integer, Hash)>)

    Array<String> data, response status code and response headers



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/indexea_client/api/search_api.rb', line 118

def search_histories_with_http_info(widget, strategy, query, size, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_histories ...'
  end
  # verify the required parameter 'widget' is set
  if @api_client.config.client_side_validation && widget.nil?
    fail ArgumentError, "Missing the required parameter 'widget' when calling SearchApi.search_histories"
  end
  # verify the required parameter 'strategy' is set
  if @api_client.config.client_side_validation && strategy.nil?
    fail ArgumentError, "Missing the required parameter 'strategy' when calling SearchApi.search_histories"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['recent', 'popular'].include?(strategy)
    fail ArgumentError, "invalid value for 'strategy', must be one of recent, popular"
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling SearchApi.search_histories"
  end
  # verify the required parameter 'size' is set
  if @api_client.config.client_side_validation && size.nil?
    fail ArgumentError, "Missing the required parameter 'size' when calling SearchApi.search_histories"
  end
  # resource path
  local_var_path = '/search/widget/{widget}/histories'.sub('{' + 'widget' + '}', widget.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'strategy'] = strategy
  query_params[:'query'] = query
  query_params[:'size'] = size

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Array<String>' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_histories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_logs(app, opts = {}) ⇒ Array<QueryActionBean>

获取搜索日志 该接口主要用于获取搜索明细

Parameters:

  • app

    应用标识

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :indices (Array<Integer>)

    只看指定索引

  • :scope (String)

    搜索范围 (default to all)

  • :widget (Integer)

    搜索组件 (default to 0)

  • :query (Integer)

    指定查询 (default to 0)

  • :recomm (Integer)

    推荐组件 (default to 0)

  • :start_date (Date)

    统计起始日期

  • :end_date (Date)

    统计结束日期

  • :from (Integer)

    起始位置 (default to 0)

  • :size (Integer)

    每页记录数量 (default to 50)

Returns:



194
195
196
197
# File 'lib/indexea_client/api/search_api.rb', line 194

def search_logs(app, opts = {})
  data, _status_code, _headers = search_logs_with_http_info(app, opts)
  data
end

#search_logs_with_http_info(app, opts = {}) ⇒ Array<(Array<QueryActionBean>, Integer, Hash)>

获取搜索日志 该接口主要用于获取搜索明细

Parameters:

  • app

    应用标识

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :indices (Array<Integer>)

    只看指定索引

  • :scope (String)

    搜索范围

  • :widget (Integer)

    搜索组件

  • :query (Integer)

    指定查询

  • :recomm (Integer)

    推荐组件

  • :start_date (Date)

    统计起始日期

  • :end_date (Date)

    统计结束日期

  • :from (Integer)

    起始位置

  • :size (Integer)

    每页记录数量

Returns:

  • (Array<(Array<QueryActionBean>, Integer, Hash)>)

    Array<QueryActionBean> data, response status code and response headers



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/indexea_client/api/search_api.rb', line 213

def search_logs_with_http_info(app, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_logs ...'
  end
  # verify the required parameter 'app' is set
  if @api_client.config.client_side_validation && app.nil?
    fail ArgumentError, "Missing the required parameter 'app' when calling SearchApi.search_logs"
  end
  if @api_client.config.client_side_validation && opts[:'scope'] && !['all', 'search', 'recomm'].include?(opts[:'scope'])
    fail ArgumentError, 'invalid value for "scope", must be one of all, search, recomm'
  end
  # resource path
  local_var_path = '/apps/{app}/logs-searchs'.sub('{' + 'app' + '}', app.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'indices'] = @api_client.build_collection_param(opts[:'indices'], :multi) if !opts[:'indices'].nil?
  query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?
  query_params[:'widget'] = opts[:'widget'] if !opts[:'widget'].nil?
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
  query_params[:'recomm'] = opts[:'recomm'] if !opts[:'recomm'].nil?
  query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Array<QueryActionBean>' 

  auth_names = opts[:auth_names] || ['TokenAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_query_histories(query, strategy, size, opts = {}) ⇒ Array<String>

获取当前搜索用户的最新搜索记录

Parameters:

  • query

    查询唯一标识

  • strategy

    搜索记录策略

  • size

    数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非公开查询,需要组件作者授权

Returns:

  • (Array<String>)


274
275
276
277
# File 'lib/indexea_client/api/search_api.rb', line 274

def search_query_histories(query, strategy, size, opts = {})
  data, _status_code, _headers = search_query_histories_with_http_info(query, strategy, size, opts)
  data
end

#search_query_histories_with_http_info(query, strategy, size, opts = {}) ⇒ Array<(Array<String>, Integer, Hash)>

获取当前搜索用户的最新搜索记录

Parameters:

  • query

    查询唯一标识

  • strategy

    搜索记录策略

  • size

    数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非公开查询,需要组件作者授权

Returns:

  • (Array<(Array<String>, Integer, Hash)>)

    Array<String> data, response status code and response headers



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/indexea_client/api/search_api.rb', line 287

def search_query_histories_with_http_info(query, strategy, size, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_query_histories ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling SearchApi.search_query_histories"
  end
  # verify the required parameter 'strategy' is set
  if @api_client.config.client_side_validation && strategy.nil?
    fail ArgumentError, "Missing the required parameter 'strategy' when calling SearchApi.search_query_histories"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['recent', 'popular'].include?(strategy)
    fail ArgumentError, "invalid value for 'strategy', must be one of recent, popular"
  end
  # verify the required parameter 'size' is set
  if @api_client.config.client_side_validation && size.nil?
    fail ArgumentError, "Missing the required parameter 'size' when calling SearchApi.search_query_histories"
  end
  # resource path
  local_var_path = '/search/query/{query}/histories'.sub('{' + 'query' + '}', query.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'strategy'] = strategy
  query_params[:'size'] = size

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Array<String>' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_query_histories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_query_hot_words(query, scope, count, opts = {}) ⇒ Array<SearchWord>

获取查询相关热词

Parameters:

  • query

    查询标识

  • scope

    时间范围

  • count

    获取热词数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

Returns:



352
353
354
355
# File 'lib/indexea_client/api/search_api.rb', line 352

def search_query_hot_words(query, scope, count, opts = {})
  data, _status_code, _headers = search_query_hot_words_with_http_info(query, scope, count, opts)
  data
end

#search_query_hot_words_with_http_info(query, scope, count, opts = {}) ⇒ Array<(Array<SearchWord>, Integer, Hash)>

获取查询相关热词

Parameters:

  • query

    查询标识

  • scope

    时间范围

  • count

    获取热词数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

Returns:

  • (Array<(Array<SearchWord>, Integer, Hash)>)

    Array<SearchWord> data, response status code and response headers



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/indexea_client/api/search_api.rb', line 365

def search_query_hot_words_with_http_info(query, scope, count, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_query_hot_words ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling SearchApi.search_query_hot_words"
  end
  # verify the required parameter 'scope' is set
  if @api_client.config.client_side_validation && scope.nil?
    fail ArgumentError, "Missing the required parameter 'scope' when calling SearchApi.search_query_hot_words"
  end
  # verify enum value
  if @api_client.config.client_side_validation && !['month', 'year', 'all'].include?(scope)
    fail ArgumentError, "invalid value for 'scope', must be one of month, year, all"
  end
  # verify the required parameter 'count' is set
  if @api_client.config.client_side_validation && count.nil?
    fail ArgumentError, "Missing the required parameter 'count' when calling SearchApi.search_query_hot_words"
  end
  # resource path
  local_var_path = '/search/query/{query}/hotwords'.sub('{' + 'query' + '}', query.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'scope'] = scope
  query_params[:'count'] = count

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Array<SearchWord>' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_query_hot_words\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_query_repeat_scroll(query, id, opts = {}) ⇒ Object

读取滚动搜索结果 先调用 search.queryScroll 获取 scroll_id 值以及第一批结果记录,然后使用 scroll_id 值调用该接口获取下一批结果记录,请注意该值的有效期是 1 分钟

Parameters:

  • query

    查询标识

  • id

    scroll_id 值,该值的有效期是 1 分钟

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

Returns:

  • (Object)


430
431
432
433
# File 'lib/indexea_client/api/search_api.rb', line 430

def search_query_repeat_scroll(query, id, opts = {})
  data, _status_code, _headers = search_query_repeat_scroll_with_http_info(query, id, opts)
  data
end

#search_query_repeat_scroll_with_http_info(query, id, opts = {}) ⇒ Array<(Object, Integer, Hash)>

读取滚动搜索结果 先调用 search.queryScroll 获取 scroll_id 值以及第一批结果记录,然后使用 scroll_id 值调用该接口获取下一批结果记录,请注意该值的有效期是 1 分钟

Parameters:

  • query

    查询标识

  • id

    scroll_id 值,该值的有效期是 1 分钟

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# File 'lib/indexea_client/api/search_api.rb', line 443

def search_query_repeat_scroll_with_http_info(query, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_query_repeat_scroll ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling SearchApi.search_query_repeat_scroll"
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling SearchApi.search_query_repeat_scroll"
  end
  # resource path
  local_var_path = '/search/scroll/{query}'.sub('{' + 'query' + '}', query.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'id'] = id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Object' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_query_repeat_scroll\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_query_scroll(query, opts = {}) ⇒ Object

基于查询的滚动搜索 用于读取超过 10000 条记录的搜索结果,当需要读取大批量查询结果时请采用此接口获得 scroll_id 值,然后再用 POST 方法 queryRepeatScroll 读取剩余的其他结果,每批次的读取间隔不能超过 1 分钟

Parameters:

  • query

    查询标识

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :size (Integer)

    单次滚动的记录数 (default to 100)

  • :q (String)

    搜索关键字

  • :params (Hash<String, String>)

    聚合参数

Returns:

  • (Object)


501
502
503
504
# File 'lib/indexea_client/api/search_api.rb', line 501

def search_query_scroll(query, opts = {})
  data, _status_code, _headers = search_query_scroll_with_http_info(query, opts)
  data
end

#search_query_scroll_with_http_info(query, opts = {}) ⇒ Array<(Object, Integer, Hash)>

基于查询的滚动搜索 用于读取超过 10000 条记录的搜索结果,当需要读取大批量查询结果时请采用此接口获得 scroll_id 值,然后再用 POST 方法 queryRepeatScroll 读取剩余的其他结果,每批次的读取间隔不能超过 1 分钟

Parameters:

  • query

    查询标识

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :size (Integer)

    单次滚动的记录数

  • :q (String)

    搜索关键字

  • :params (Hash<String, String>)

    聚合参数

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/indexea_client/api/search_api.rb', line 516

def search_query_scroll_with_http_info(query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_query_scroll ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling SearchApi.search_query_scroll"
  end
  # resource path
  local_var_path = '/search/scroll/{query}'.sub('{' + 'query' + '}', query.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'params'] = @api_client.build_collection_param(opts[:'params'], :multi) if !opts[:'params'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Object' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_query_scroll\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_query_search(query, from, size, opts = {}) ⇒ Object

基于查询的公开搜索 该接口主要用于公开搜索,如果查询是公开的就不需要授权

Parameters:

  • query

    查询标识

  • from

    起始记录

  • size

    每页记录数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :q (String)

    搜索关键字

  • :params (Hash<String, String>)

    聚合参数

Returns:

  • (Object)


573
574
575
576
# File 'lib/indexea_client/api/search_api.rb', line 573

def search_query_search(query, from, size, opts = {})
  data, _status_code, _headers = search_query_search_with_http_info(query, from, size, opts)
  data
end

#search_query_search_with_http_info(query, from, size, opts = {}) ⇒ Array<(Object, Integer, Hash)>

基于查询的公开搜索 该接口主要用于公开搜索,如果查询是公开的就不需要授权

Parameters:

  • query

    查询标识

  • from

    起始记录

  • size

    每页记录数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :q (String)

    搜索关键字

  • :params (Hash<String, String>)

    聚合参数

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# File 'lib/indexea_client/api/search_api.rb', line 589

def search_query_search_with_http_info(query, from, size, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_query_search ...'
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling SearchApi.search_query_search"
  end
  # verify the required parameter 'from' is set
  if @api_client.config.client_side_validation && from.nil?
    fail ArgumentError, "Missing the required parameter 'from' when calling SearchApi.search_query_search"
  end
  # verify the required parameter 'size' is set
  if @api_client.config.client_side_validation && size.nil?
    fail ArgumentError, "Missing the required parameter 'size' when calling SearchApi.search_query_search"
  end
  # resource path
  local_var_path = '/search/query/{query}'.sub('{' + 'query' + '}', query.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = from
  query_params[:'size'] = size
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'params'] = @api_client.build_collection_param(opts[:'params'], :multi) if !opts[:'params'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Object' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_query_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_widget_auto_complete(widget, query, q, size, opts = {}) ⇒ Array<AutoCompleteItem>

基于组件的搜索词自动完成 该接口主要为搜索输入框提供自动完成的功能

Parameters:

  • widget

    组件唯一标识

  • query

    查询编号

  • q

    搜索关键字

  • size

    数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

Returns:



654
655
656
657
# File 'lib/indexea_client/api/search_api.rb', line 654

def search_widget_auto_complete(widget, query, q, size, opts = {})
  data, _status_code, _headers = search_widget_auto_complete_with_http_info(widget, query, q, size, opts)
  data
end

#search_widget_auto_complete_with_http_info(widget, query, q, size, opts = {}) ⇒ Array<(Array<AutoCompleteItem>, Integer, Hash)>

基于组件的搜索词自动完成 该接口主要为搜索输入框提供自动完成的功能

Parameters:

  • widget

    组件唯一标识

  • query

    查询编号

  • q

    搜索关键字

  • size

    数量

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

Returns:

  • (Array<(Array<AutoCompleteItem>, Integer, Hash)>)

    Array<AutoCompleteItem> data, response status code and response headers



669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
# File 'lib/indexea_client/api/search_api.rb', line 669

def search_widget_auto_complete_with_http_info(widget, query, q, size, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_widget_auto_complete ...'
  end
  # verify the required parameter 'widget' is set
  if @api_client.config.client_side_validation && widget.nil?
    fail ArgumentError, "Missing the required parameter 'widget' when calling SearchApi.search_widget_auto_complete"
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling SearchApi.search_widget_auto_complete"
  end
  # verify the required parameter 'q' is set
  if @api_client.config.client_side_validation && q.nil?
    fail ArgumentError, "Missing the required parameter 'q' when calling SearchApi.search_widget_auto_complete"
  end
  # verify the required parameter 'size' is set
  if @api_client.config.client_side_validation && size.nil?
    fail ArgumentError, "Missing the required parameter 'size' when calling SearchApi.search_widget_auto_complete"
  end
  # resource path
  local_var_path = '/search/widget/{widget}/autocomplete'.sub('{' + 'widget' + '}', widget.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'query'] = query
  query_params[:'q'] = q
  query_params[:'size'] = size

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Array<AutoCompleteItem>' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_widget_auto_complete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_widget_hot_words(widget, opts = {}) ⇒ Array<SearchWord>

获取组件搜索的相关热词

Parameters:

  • widget

    组件唯一标识

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :query (Integer)

    查询编号

  • :scope (String)

    时间范围

  • :count (Integer)

    获取热词数量 (default to 10)

Returns:



736
737
738
739
# File 'lib/indexea_client/api/search_api.rb', line 736

def search_widget_hot_words(widget, opts = {})
  data, _status_code, _headers = search_widget_hot_words_with_http_info(widget, opts)
  data
end

#search_widget_hot_words_with_http_info(widget, opts = {}) ⇒ Array<(Array<SearchWord>, Integer, Hash)>

获取组件搜索的相关热词

Parameters:

  • widget

    组件唯一标识

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :query (Integer)

    查询编号

  • :scope (String)

    时间范围

  • :count (Integer)

    获取热词数量

Returns:

  • (Array<(Array<SearchWord>, Integer, Hash)>)

    Array<SearchWord> data, response status code and response headers



750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
# File 'lib/indexea_client/api/search_api.rb', line 750

def search_widget_hot_words_with_http_info(widget, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_widget_hot_words ...'
  end
  # verify the required parameter 'widget' is set
  if @api_client.config.client_side_validation && widget.nil?
    fail ArgumentError, "Missing the required parameter 'widget' when calling SearchApi.search_widget_hot_words"
  end
  if @api_client.config.client_side_validation && opts[:'scope'] && !['month', 'year', 'all', 'custom'].include?(opts[:'scope'])
    fail ArgumentError, 'invalid value for "scope", must be one of month, year, all, custom'
  end
  # resource path
  local_var_path = '/search/widget/{widget}/hotwords'.sub('{' + 'widget' + '}', widget.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
  query_params[:'scope'] = opts[:'scope'] if !opts[:'scope'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Array<SearchWord>' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_widget_hot_words\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_widget_search(widget, query, from, size, opts = {}) ⇒ Object

基于组件的公开搜索 该接口主要为UI组件提供公开搜索

Parameters:

  • widget

    组件唯一标识

  • query

    查询编号

  • from

    起始记录

  • size

    每页记录数量, 如果值小于0则使用预设值的记录数

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :original (String)

    搜索动作的延续,在 Web 组件中一边输入即时搜索时,使用的是同一个 original,original 值等于第一个搜索动作产生结果中的 action 值

  • :q (String)

    搜索关键字

  • :params (Hash<String, String>)

    聚合参数

Returns:

  • (Object)


812
813
814
815
# File 'lib/indexea_client/api/search_api.rb', line 812

def search_widget_search(widget, query, from, size, opts = {})
  data, _status_code, _headers = search_widget_search_with_http_info(widget, query, from, size, opts)
  data
end

#search_widget_search_with_http_info(widget, query, from, size, opts = {}) ⇒ Array<(Object, Integer, Hash)>

基于组件的公开搜索 该接口主要为UI组件提供公开搜索

Parameters:

  • widget

    组件唯一标识

  • query

    查询编号

  • from

    起始记录

  • size

    每页记录数量, 如果值小于0则使用预设值的记录数

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :userid (String)

    搜索者的唯一标识,该标识由搜索前端生成,长度不超过64

  • :x_token (String)

    如果要使用非发布的组件,需要组件作者授权

  • :original (String)

    搜索动作的延续,在 Web 组件中一边输入即时搜索时,使用的是同一个 original,original 值等于第一个搜索动作产生结果中的 action 值

  • :q (String)

    搜索关键字

  • :params (Hash<String, String>)

    聚合参数

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
# File 'lib/indexea_client/api/search_api.rb', line 830

def search_widget_search_with_http_info(widget, query, from, size, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SearchApi.search_widget_search ...'
  end
  # verify the required parameter 'widget' is set
  if @api_client.config.client_side_validation && widget.nil?
    fail ArgumentError, "Missing the required parameter 'widget' when calling SearchApi.search_widget_search"
  end
  # verify the required parameter 'query' is set
  if @api_client.config.client_side_validation && query.nil?
    fail ArgumentError, "Missing the required parameter 'query' when calling SearchApi.search_widget_search"
  end
  # verify the required parameter 'from' is set
  if @api_client.config.client_side_validation && from.nil?
    fail ArgumentError, "Missing the required parameter 'from' when calling SearchApi.search_widget_search"
  end
  # verify the required parameter 'size' is set
  if @api_client.config.client_side_validation && size.nil?
    fail ArgumentError, "Missing the required parameter 'size' when calling SearchApi.search_widget_search"
  end
  # resource path
  local_var_path = '/search/widget/{widget}'.sub('{' + 'widget' + '}', widget.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'query'] = query
  query_params[:'from'] = from
  query_params[:'size'] = size
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'params'] = @api_client.build_collection_param(opts[:'params'], :multi) if !opts[:'params'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'userid'] = opts[:'userid'] if !opts[:'userid'].nil?
  header_params[:'x-token'] = opts[:'x_token'] if !opts[:'x_token'].nil?
  header_params[:'original'] = opts[:'original'] if !opts[:'original'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  return_type = opts[:return_type] || 'Object' 

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SearchApi#search_widget_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end