Class: GdsApi::Search::V2

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/gds_api/search.rb

Defined Under Namespace

Classes: InvalidIndex

Instance Method Summary collapse

Instance Method Details

#add_document(id, document, index_name) ⇒ Object

Raises:



32
33
34
35
36
37
38
39
40
41
# File 'lib/gds_api/search.rb', line 32

def add_document(id, document, index_name)
  raise(InvalidIndex, index_name) unless index_name == "metasearch"

  post_json(
    "#{base_url}/v2/metasearch/documents",
    document.merge(
      _id: id,
    ),
  )
end

#delete_document(id, index_name) ⇒ Object

Raises:



43
44
45
46
47
# File 'lib/gds_api/search.rb', line 43

def delete_document(id, index_name)
  raise(InvalidIndex, index_name) unless index_name == "metasearch"

  delete_json("#{base_url}/v2/metasearch/documents/#{id}")
end