diff options
author | 2015-02-23 01:05:20 +0100 | |
---|---|---|
committer | 2015-02-23 01:05:20 +0100 | |
commit | d3a8004768e26095748003e7932ea500b26eaa6a (patch) | |
tree | 98ab3c6ced02e5442ecbad5d9b7e3344ef78d95c | |
parent | Implement --info (diff) | |
download | backend-d3a8004768e26095748003e7932ea500b26eaa6a.tar.gz backend-d3a8004768e26095748003e7932ea500b26eaa6a.tar.bz2 backend-d3a8004768e26095748003e7932ea500b26eaa6a.zip |
Implement --delete
TODO: Actually delete the message
-rwxr-xr-x | ag | 8 | ||||
-rw-r--r-- | lib/storage.rb | 5 |
2 files changed, 12 insertions, 1 deletions
@@ -142,7 +142,13 @@ def do_incremental end def do_delete - abort 'Come back later.' + id = Ag::Utils.resolve_id + + begin + Ag::Storage.delete($options.name, id) + rescue => e + $stderr.puts "Cannot delete message: #{e}" + end end def do_reindex diff --git a/lib/storage.rb b/lib/storage.rb index b4a518e..f255633 100644 --- a/lib/storage.rb +++ b/lib/storage.rb @@ -220,6 +220,11 @@ module Ag::Storage result['hits']['total'] end + + def delete(list, id) + $es.delete(index: 'ml-' + list, type: 'message', id: id) + end + def get(list, id) result = $es.search( index: 'ml-' + list, |