 
     client.post "search/", data, (err, res, resbody) ->
         if err
-            send 500
+            send error: err.message, 500
         else if not res?
-            send 500
+            send error: err.message, 500
         else if res.statusCode != 200
             send resbody, res.statusCode
         else
             db.get resbody.ids, (err, docs) ->
                 if err
-                    send 500
+                    send error: err.message, 500
                 else
                     results = []
                     for doc in docs

action 'removeAll', ->
    client.del "clear-all/", (err, res, resbody) ->
        if err
            send 500
        else
            send {success: true, msg: resbody}, res.statusCode
    , false  # body is not JSON

            fields: body.fields
        client.post "index/", data, (err, res, resbody) ->
            if err or res.statusCode != 200
                send error: JSON.stringify err, 500
            else
                send success: true, 200
        , false # body = indexation succeeds, do not parse

    db.get params.id, (err, doc) ->
