Class: Marqo::Client
- Inherits:
-
Object
- Object
- Marqo::Client
- Defined in:
- lib/marqo/client.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#index_name ⇒ Object
Returns the value of attribute index_name.
Instance Method Summary collapse
- #add_documents(documents, options = {}) ⇒ Object
- #create_index(index_name, options = {}) ⇒ Object
- #delete_docs(document_ids) ⇒ Object
- #delete_index ⇒ Object
- #device_cpu ⇒ Object
- #device_cuda ⇒ Object
- #find_doc(document_id, options = {}) ⇒ Object
- #find_docs(document_ids) ⇒ Object
-
#initialize(ept = nil, name = nil) ⇒ Client
constructor
A new instance of Client.
- #list_index ⇒ Object
- #search(query, options = {}) ⇒ Object
Constructor Details
#initialize(ept = nil, name = nil) ⇒ Client
Returns a new instance of Client.
5 6 7 8 |
# File 'lib/marqo/client.rb', line 5 def initialize(ept = nil, name = nil) self.endpoint = ept || Marqo.configuration.endpoint self.index_name = name || Marqo.configuration.index_name end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/marqo/client.rb', line 3 def endpoint @endpoint end |
#index_name ⇒ Object
Returns the value of attribute index_name.
3 4 5 |
# File 'lib/marqo/client.rb', line 3 def index_name @index_name end |
Instance Method Details
#add_documents(documents, options = {}) ⇒ Object
22 23 24 |
# File 'lib/marqo/client.rb', line 22 def add_documents(documents, = {}) Marqo::Document.create(endpoint, index_name, documents, ) end |
#create_index(index_name, options = {}) ⇒ Object
10 11 12 |
# File 'lib/marqo/client.rb', line 10 def create_index(index_name, = {}) Marqo::Index.create(endpoint, index_name, ) end |
#delete_docs(document_ids) ⇒ Object
34 35 36 |
# File 'lib/marqo/client.rb', line 34 def delete_docs(document_ids) Marqo::Document.delete(endpoint, index_name, document_ids) end |
#delete_index ⇒ Object
18 19 20 |
# File 'lib/marqo/client.rb', line 18 def delete_index Marqo::Index.delete(endpoint, index_name) end |
#device_cpu ⇒ Object
42 43 44 |
# File 'lib/marqo/client.rb', line 42 def device_cpu Marqo::Device.cpu(endpoint) end |
#device_cuda ⇒ Object
46 47 48 |
# File 'lib/marqo/client.rb', line 46 def device_cuda Marqo::Device.cuda(endpoint) end |
#find_doc(document_id, options = {}) ⇒ Object
26 27 28 |
# File 'lib/marqo/client.rb', line 26 def find_doc(document_id, = {}) Marqo::Document.find(endpoint, index_name, document_id, ) end |
#find_docs(document_ids) ⇒ Object
30 31 32 |
# File 'lib/marqo/client.rb', line 30 def find_docs(document_ids) Marqo::Document.finds(endpoint, index_name, document_ids) end |