33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/chef/solr/index_queue_consumer.rb', line 33
def add(payload)
index = Chef::Solr::Index.new
Chef::Log.debug("Dequeued item for indexing: #{payload.inspect}")
begin
pitem = payload["item"].to_hash
pitem.delete("json_class")
response = generate_response { index.add(payload["id"], payload["database"], payload["type"], pitem) }
rescue NoMethodError
response = generate_response() { raise ArgumentError, "Payload item does not respond to :keys or :to_hash, cannot index!" }
end
msg = "Indexing #{payload["type"]} #{payload["id"]} from #{payload["database"]} status #{status_message(response)}}"
Chef::Log.info(msg)
response
end
|