TSocket transport = new TSocket(indexServerHost, indexServerPort + 1);
TProtocol protocol = new TBinaryProtocol(transport);
client = new Indexer.Client(protocol);
try {
transport.open();
IndexStorage storage = getStorage();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in), 200);
String docId;
System.out.println("Enter the document Ids to recover, separated by enters.\nHit ctr-d to end.");
while ((docId = in.readLine()) != null && docId.length() != 0) {
BoostedDocument doc;
try {
doc = storage.getDocument(docId, false);
} catch (NullPointerException e) {
System.out.println("document " + docId + " is not in the storage.\nDELETING DOCUMENT.");
client.delDoc(docId);
continue;
}