Reads all Parquet files below corpus into one DuckDB database file: one
row per work (duplicates across partitions removed), with helper columns
for ID and DOI matching and the abstract as text. The database is cached
and reused while the corpus files are unchanged (same paths, sizes and
modification times).
Usage
prepare_corpus(
corpus,
rebuild = FALSE,
cache_dir = tools::R_user_dir("openalexAPI", "cache")
)Details
The corpus can come from openalexPro::pro_request_parquet() (keeps
abstract_inverted_index and adds abstract), from the JSONL path (only
abstract), from a snapshot extraction, or from any source with the
OpenAlex works schema. Hive partition columns are not read.