final byte[] fromKey = computeDocKey(doc.getDocId());
final byte[] toKey = computeDocKey(doc.getDocId() + 1);
final IndexQuery query = new IndexQuery(IndexQuery.RANGE, new Value(fromKey), new Value(toKey));
final Lock lock = index.btree.getLock();
try {
lock.acquire(Lock.WRITE_LOCK);
index.btree.remove(query, null);
} catch (final LockException e) {
NativeStructuralIndex.LOG.warn("Failed to lock structural index: " + e.getMessage(), e);
} catch (final Exception e) {
NativeStructuralIndex.LOG.warn("Exception caught while reading structural index for document " +