SearchQuery searchByResource = new SearchQueryImpl(uri.getSite());
searchByResource.withVersion(Resource.LIVE);
searchByResource.withProperty("resourceid", uri.getIdentifier());
if (searchIndex.getByQuery(searchByResource).getDocumentCount() > 0) {
logger.debug("Resource '{}' is still being referenced", uri);
throw new ReferentialIntegrityException(uri.getIdentifier());
}
}
// Get the revisions to delete
long[] revisions = new long[] { uri.getVersion() };