How to Build a Fast Local Search Index from Your X (Twitter) Archive
A developer has outlined a method to convert a large X (formerly Twitter) data archive — typically 150 to 400 MB — into a lightweight, queryable local search index. The core challenge is that parsing the archive's main file, tweets.js, as a single JSON object causes Node.js to exceed its default memory heap limit. The solution involves streaming the file and processing one record at a time, so memory usage stays proportional to a single post rather than the entire dataset. The resulting index, stored as NDJSON, can be searched instantly using grep or loaded into DuckDB for ranked, full-text queries. Because post IDs increase monotonically, the index can be updated incrementally when a new archive export is downloaded, avoiding a full rebuild.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in