Skip to content

fix(search): Update Algolia search to index during build and improve visual display, ranking, and sorting of search results#1231

Draft
jderochervlk wants to merge 13 commits intomasterfrom
vlk/fix-algolia
Draft

fix(search): Update Algolia search to index during build and improve visual display, ranking, and sorting of search results#1231
jderochervlk wants to merge 13 commits intomasterfrom
vlk/fix-algolia

Conversation

@jderochervlk
Copy link
Copy Markdown
Collaborator

@jderochervlk jderochervlk commented Apr 6, 2026

I made it so Algolia gets updated from a script during the build process. This will help keep things up to date. I also changed the way ranking and sorting work so the results feel more target at what we would expect when searching for things like array or array map. There are also some visual changes as the search results show more text and code snippets are inside of <code/> blocks.

Note

This work was done with AI assistance

AI summary

This pull request introduces a major upgrade to the search infrastructure by integrating Algolia-powered site search, including a new build pipeline for generating and uploading search indexes, environment configuration updates, new bindings, and improved URL version parsing. It also adds new test coverage and several utility enhancements.

Algolia Search Integration

  • Added a new build script (scripts/generate_search_index.res) that compiles all site content into Algolia search records and uploads them, with index settings configured for optimal search ranking and faceting. This script is invoked as part of the build process.
  • Introduced new ReScript bindings for the Algolia search client (src/bindings/Algolia.res) to support index upload and configuration from the build script.
  • Updated the build process in package.json to include the search index generation step and added the algoliasearch dependency. [1] [2]

Environment and Configuration

  • Updated .env to include Algolia credentials and index name, and bumped documentation version numbers.
  • Exposed Algolia configuration variables in src/bindings/Env.res for use in the application.

Search Index Utilities

  • Defined a comprehensive API for search record construction and utilities in src/common/SearchIndex.resi, including types and helper functions for content extraction and formatting.

Testing and Utility Improvements

  • Added extensive tests for URL version detection in __tests__/Url_.test.res and improved the version parsing regex in src/common/Url.res to handle both v-prefixed and non-prefixed versions. [1] [2]
  • Improved Vitest bindings to support test grouping and deep equality checks. [1] [2]

UI Enhancements

  • Added new icon components for search result types in src/components/Icon.res and their interface in src/components/Icon.resi. [1] [2]
  • Updated DocSearch search parameter bindings for greater flexibility.
  • Removed hardcoded DocSearch meta tag from src/components/Meta.res to rely on dynamic versioning.

Before

image image

After

image image

….14, tsdown 0.21

Vite ecosystem:
- vite: ^7.0.6 -> ^8.0.3
- @vitejs/plugin-react: ^4.7.0 -> ^6.0.1
- @tailwindcss/vite: ^4.1.13 -> ^4.2.2
- vite-plugin-page-reload: ^0.2.2 -> ^0.2.3

Vitest ecosystem:
- vitest: ^4.0.18 -> ^4.1.2
- @vitest/browser-playwright: ^4.0.18 -> ^4.1.2
- vitest-browser-react: ^2.0.5 -> ^2.2.0

React:
- react: ^19.1.0 -> ^19.2.4
- react-dom: ^19.1.0 -> ^19.2.4
- @types/react: ^19.2.2 -> ^19.2.14

ReScript:
- rescript: ^12.0.0 -> ^12.2.0
- @rescript/react: ^0.14.0 -> ^0.14.2
- Migrate Exn.Error -> JsExn (deprecated in 12.2)

React Router:
- react-router: ^7.12.0 -> ^7.14.0
- react-router-dom: ^7.9.4 -> ^7.14.0
- @react-router/node: ^7.8.1 -> ^7.14.0
- @react-router/dev: ^7.8.1 -> ^7.14.0

tsdown: 0.20.0 -> 0.21.7 (in build:scripts)
@fhammerschmidt
Copy link
Copy Markdown
Member

Cool stuff. btw can you fix the clear button? Looks very weird to me as if the "Clear" text was supposed to be a popover or something.

@jderochervlk jderochervlk changed the title Vlk/fix algolia fix(search): Update Algolia search to index during build and improve visual display, ranking, and sorting of search results Apr 9, 2026
- Hide clear and cancel buttons for cleaner UI
- Redesign footer with border and spacing adjustments
- Add styles for command key display in footer
Update DocSearch commands to show 'to clear' when input has text and 'to close' when empty
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

Cloudflare deployment

Deployement ID: d6883c36-3dc6-49e5-920a-8fcd7485c8d2
Deployment Environment: preview

⛅️ wrangler 4.63.0 (update available 4.81.0)
─────────────────────────────────────────────
✨ Compiled Worker successfully
Uploading... (7186/7664)
Uploading... (7346/7664)
Uploading... (7505/7664)
Uploading... (7664/7664)
✨ Success! Uploaded 478 files (7186 already uploaded) (4.55 sec)

✨ Uploading _redirects
✨ Uploading Functions bundle
🌎 Deploying...
✨ Deployment complete! Take a peek over at https://d6883c36.rescript-lang.pages.dev
✨ Deployment alias URL: https://vlk-fix-algolia.rescript-lang.pages.dev

@jderochervlk
Copy link
Copy Markdown
Collaborator Author

Cool stuff. btw can you fix the clear button? Looks very weird to me as if the "Clear" text was supposed to be a popover or something.

I removed it and updated the footer to show clear or close with the ESC key depending on if there is text in the search box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants