fix off-by-one error
clean up test docs; fix encoding warnings for diag(); better solution to search latency issue
move latency re-try logic into get_doc() method and avoid sleeps in tests; all tests now passing again