Class: Manticore::Client::SearchApi
- Inherits:
-
Object
- Object
- Manticore::Client::SearchApi
- Defined in:
- lib/manticore/client/api/search_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#autocomplete(autocomplete_request, opts = {}) ⇒ Array<Object>
Performs an autocomplete search on a table The method expects an object with the following mandatory properties: * the name of the table to search * the query string to autocomplete For details, see the documentation on [Autocomplete](Autocomplete.md) An example: “‘ { "table":"table_name", "query":"query_beginning" } “` An example of the method’s response: “‘ [ { "total": 3, "error": "", "warning": "", "columns": [ { "query": { "type": "string" } } ], "data": [ { "query": "hello" }, { "query": "helio" }, { "query": "hell" } ] } ] “` For more detailed information about the autocomplete queries, please refer to the documentation [here](manual.manticoresearch.com/Searching/Autocomplete).
-
#autocomplete_with_http_info(autocomplete_request, opts = {}) ⇒ Array<(Array<Object>, Integer, Hash)>
Performs an autocomplete search on a table The method expects an object with the following mandatory properties: * the name of the table to search * the query string to autocomplete For details, see the documentation on [Autocomplete](Autocomplete.md) An example: ``` { "table":"table_name", "query":"query_beginning" } ``` An example of the method's response: ``` [ { "total": 3, "error": "", "warning": "", "columns": [ { "query": { "type": "string" } } ], "data": [ { "query": "hello" }, { "query": "helio" }, { "query": "hell" } ] } ] ``` For more detailed information about the autocomplete queries, please refer to the documentation [here](manual.manticoresearch.com/Searching/Autocomplete).
-
#initialize(api_client = ApiClient.default) ⇒ SearchApi
constructor
A new instance of SearchApi.
-
#percolate(table, percolate_request, opts = {}) ⇒ SearchResponse
Perform reverse search on a percolate table Performs a percolate search.
-
#percolate_with_http_info(table, percolate_request, opts = {}) ⇒ Array<(SearchResponse, Integer, Hash)>
Perform reverse search on a percolate table Performs a percolate search.
-
#search(search_request, opts = {}) ⇒ SearchResponse
Performs a search on a table The method expects an object with the following mandatory properties: * the name of the table to search * the match query object For details, see the documentation on [SearchRequest](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query.
-
#search_with_http_info(search_request, opts = {}) ⇒ Array<(SearchResponse, Integer, Hash)>
Performs a search on a table The method expects an object with the following mandatory properties: * the name of the table to search * the match query object For details, see the documentation on [SearchRequest](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/manticore/client/api/search_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#autocomplete(autocomplete_request, opts = {}) ⇒ Array<Object>
Performs an autocomplete search on a table
The method expects an object with the following mandatory properties: * the name of the table to search * the query string to autocomplete For details, see the documentation on [**Autocomplete**](Autocomplete.md) An example: ``` { \"table\":\"table_name\", \"query\":\"query_beginning\" } ``` An example of the method's response: ``` [ { \"total\": 3, \"error\": \"\", \"warning\": \"\", \"columns\": [ { \"query\": { \"type\": \"string\" } } ], \"data\": [ { \"query\": \"hello\" }, { \"query\": \"helio\" }, { \"query\": \"hell\" } ] } ] ``` For more detailed information about the autocomplete queries, please refer to the documentation [here](https://manual.manticoresearch.com/Searching/Autocomplete).
27 28 29 30 |
# File 'lib/manticore/client/api/search_api.rb', line 27 def autocomplete(autocomplete_request, opts = {}) data, _status_code, _headers = autocomplete_with_http_info(autocomplete_request, opts) data end |
#autocomplete_with_http_info(autocomplete_request, opts = {}) ⇒ Array<(Array<Object>, Integer, Hash)>
Performs an autocomplete search on a table
The method expects an object with the following mandatory properties: * the name of the table to search * the query string to autocomplete For details, see the documentation on [**Autocomplete**](Autocomplete.md) An example: ``` { \"table\":\"table_name\", \"query\":\"query_beginning\" } ``` An example of the method's response: ``` [ { \"total\": 3, \"error\": \"\", \"warning\": \"\", \"columns\": [ { \"query\": { \"type\": \"string\" } } ], \"data\": [ { \"query\": \"hello\" }, { \"query\": \"helio\" }, { \"query\": \"hell\" } ] } ] ``` For more detailed information about the autocomplete queries, please refer to the documentation [here](https://manual.manticoresearch.com/Searching/Autocomplete).
37 38 39 40 41 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 |
# File 'lib/manticore/client/api/search_api.rb', line 37 def autocomplete_with_http_info(autocomplete_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SearchApi.autocomplete ...' end # verify the required parameter 'autocomplete_request' is set if @api_client.config.client_side_validation && autocomplete_request.nil? fail ArgumentError, "Missing the required parameter 'autocomplete_request' when calling SearchApi.autocomplete" end # resource path local_var_path = '/autocomplete' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(autocomplete_request) # return_type return_type = opts[:debug_return_type] || 'Array<Object>' # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"SearchApi.autocomplete", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SearchApi#autocomplete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#percolate(table, percolate_request, opts = {}) ⇒ SearchResponse
Perform reverse search on a percolate table Performs a percolate search. This method must be used only on percolate tables. Expects two parameters: the table name and an object with array of documents to be tested. An example of the documents object: “‘ { "query" { "percolate": { "document": { "content":"sample content" } } } } “` Responds with an object with matched stored queries: “` { ’timed_out’:false, ‘hits’: { ‘total’:2, ‘max_score’:1, ‘hits’: [ { ‘table’:‘idx_pq_1’, ‘_type’:‘doc’, ‘_id’:‘2’, ‘_score’:‘1’, ‘_source’: { ‘query’: { ‘match’:‘title’:‘some’ } } }, { ‘table’:‘idx_pq_1’, ‘_type’:‘doc’, ‘_id’:‘5’, ‘_score’:‘1’, ‘_source’: { ‘query’: { ‘ql’:‘some | none’ } } } ] } } “‘
96 97 98 99 |
# File 'lib/manticore/client/api/search_api.rb', line 96 def percolate(table, percolate_request, opts = {}) data, _status_code, _headers = percolate_with_http_info(table, percolate_request, opts) data end |
#percolate_with_http_info(table, percolate_request, opts = {}) ⇒ Array<(SearchResponse, Integer, Hash)>
Perform reverse search on a percolate table Performs a percolate search. This method must be used only on percolate tables. Expects two parameters: the table name and an object with array of documents to be tested. An example of the documents object: ``` { "query" { "percolate": { "document": { "content":"sample content" } } } } ``` Responds with an object with matched stored queries: ``` { 'timed_out':false, 'hits': { 'total':2, 'max_score':1, 'hits': [ { 'table':'idx_pq_1', '_type':'doc', '_id':'2', '_score':'1', '_source': { 'query': { 'match':Manticore::Client::SearchApi.'title':&'title':'some&'title':'some' } } }, { 'table':'idx_pq_1', '_type':'doc', '_id':'5', '_score':'1', '_source': { 'query': { 'ql':'some | none' } } } ] } } ```
107 108 109 110 111 112 113 114 115 116 117 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 |
# File 'lib/manticore/client/api/search_api.rb', line 107 def percolate_with_http_info(table, percolate_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SearchApi.percolate ...' end # verify the required parameter 'table' is set if @api_client.config.client_side_validation && table.nil? fail ArgumentError, "Missing the required parameter 'table' when calling SearchApi.percolate" end # verify the required parameter 'percolate_request' is set if @api_client.config.client_side_validation && percolate_request.nil? fail ArgumentError, "Missing the required parameter 'percolate_request' when calling SearchApi.percolate" end # resource path local_var_path = '/pq/{table}/search'.sub('{' + 'table' + '}', CGI.escape(table.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(percolate_request) # return_type return_type = opts[:debug_return_type] || 'SearchResponse' # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"SearchApi.percolate", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SearchApi#percolate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#search(search_request, opts = {}) ⇒ SearchResponse
Performs a search on a table
The method expects an object with the following mandatory properties: * the name of the table to search * the match query object For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Also, if pagination is enabled, the response will include an additional 'scroll' property with a scroll token to use for pagination Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON).
169 170 171 172 |
# File 'lib/manticore/client/api/search_api.rb', line 169 def search(search_request, opts = {}) data, _status_code, _headers = search_with_http_info(search_request, opts) data end |
#search_with_http_info(search_request, opts = {}) ⇒ Array<(SearchResponse, Integer, Hash)>
Performs a search on a table
The method expects an object with the following mandatory properties: * the name of the table to search * the match query object For details, see the documentation on [**SearchRequest**](SearchRequest.md) The method returns an object with the following properties: - took: the time taken to execute the search query. - timed_out: a boolean indicating whether the query timed out. - hits: an object with the following properties: - total: the total number of hits found. - hits: an array of hit objects, where each hit object represents a matched document. Each hit object has the following properties: - _id: the ID of the matched document. - _score: the score of the matched document. - _source: the source data of the matched document. In addition, if profiling is enabled, the response will include an additional array with profiling information attached. Also, if pagination is enabled, the response will include an additional 'scroll' property with a scroll token to use for pagination Here is an example search response: ``` { 'took':10, 'timed_out':false, 'hits': { 'total':2, 'hits': [ {'_id':'1','_score':1,'_source':{'gid':11}}, {'_id':'2','_score':1,'_source':{'gid':12}} ] } } ``` For more information about the match query syntax and additional parameters that can be added to request and response, please see the documentation [here](https://manual.manticoresearch.com/Searching/Full_text_matching/Basic_usage#HTTP-JSON).
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/manticore/client/api/search_api.rb', line 179 def search_with_http_info(search_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SearchApi.search ...' end # verify the required parameter 'search_request' is set if @api_client.config.client_side_validation && search_request.nil? fail ArgumentError, "Missing the required parameter 'search_request' when calling SearchApi.search" end # resource path local_var_path = '/search' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(search_request) # return_type return_type = opts[:debug_return_type] || 'SearchResponse' # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"SearchApi.search", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: SearchApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |