LOGIN-276 Build metadata on cache miss.
Enhance the query endpoint to delegate to metadata build machinery when a document is not found in the cache.
Enhance the query endpoint to delegate to metadata build machinery when a document is not found in the cache.