Since this is returning a generator anyway, it'd be more readable to write this as a `for/yield`:

    for doc_id in doc_ids(index_path, terms):
        yield Path(os.path.relpath(parent[doc_id].abspath(), start='.'))