Get integral text without repeating

Checks if we have the integral text of a given document before trying to
get it.
check_text error handling and logging