Full text search, again - Sat Nov 11202311:51 AM
Full text search, again
I set up in-memory full text search (for the second time) on all my site’s mdx
documents.
This leverages the Unified.js ecosystem for MDX parsing and Orama (formerly Lyra) for indexing and searching.
The indexing happens at build time, and the index is persisted as a JSON file. At runtime, the JSON file is loaded into memory and used inside an API route. CloudFront caching helps to reduce the compute load as well, and speed up response times of repeat requests.
Some code dumps
ETL code snippet.
Next.js GET /api/search
route handler