Made documentrepository.generate actually use the new inmemory support when available. Queries that used to take 12 sec now takes 5, so improvements, but still too slow for practical use