Rewrite the function to check URIs before doing index operations

Rewrite checkApiDocUris and add two convenience function for
checking the existence/absence of documents (identified by the URI)
in the index
Cleanup