public void reindex(String cmd, NoSqlEntityManager mgr) {
String oldCommand = cmd.substring(8);
String command = oldCommand.trim();
ColFamilyData data = parseData(mgr, command);
NoSqlTypedSession s = mgr.getTypedSession();
String cf = data.getColFamily();
String field = data.getColumn();
String by = data.getPartitionBy();
String id = data.getPartitionId();
DboTableMeta meta = data.getTableMeta();
DboColumnMeta colMeta = data.getColumnMeta();
if (!colMeta.isIndexed()) {
// check if it was indexed earlier and now not indexed. If yes, then remove the indices.
// Issue #120
System.out.println("The column " + field + " is not indexed");
ScanInfo info = ScanInfo.createScanInfo(colMeta, by, id);
DboTableMeta indexTableMeta = mgr.find(DboTableMeta.class, info.getIndexColFamily());
System.out.println("Wait...we are checking if it was indexed earlier and removing all its old indexes.");
mgr.getSession().remove(indexTableMeta, info.getRowKey());
s.flush();
return;
}
Cursor<IndexPoint> indexView = s.indexView(cf, field, by, id);
Cursor<IndexPoint> indexView2 = s.indexView(cf, field, by, id);
System.out.println("indexed value type="+colMeta.getStorageType());
System.out.println("row key type="+meta.getIdColumnMeta().getStorageType());
System.out.println("It is safe to kill this process at any time since it only removes duplicates");
System.out.println("Beginning re-index");