Choosing Between GitBook Native Search and Algolia DocSearch for Documentation Sites
Compare GitBook’s built‑in search with Algolia DocSearch, see the trade‑offs, and follow a step‑by‑step guide to enable DocSearch and verify it works.
22 Aug 2025, 09:10 UTC

Decision and Constraints
You need a search solution for a GitBook‑hosted documentation site that works instantly, stays within the free tier of GitBook, and can scale if the documentation grows. The solution must be easy to enable, require minimal ongoing maintenance, and provide relevant results without heavy customization.
Option Comparison
| Feature | GitBook Native Search | Algolia DocSearch |
|---|---|---|
| Setup | Enabled directly in book.json under plugins | Requires an Algolia account, DocSearch plugin, and a scraper to build the index |
| Relevance | Basic keyword matching; no typo tolerance or ranking rules | Configurable ranking, typo tolerance, faceting, synonyms, and custom relevance tuning |
| Indexing | Automatic on each site publish | Periodic crawl (default daily) via the DocSearch scraper; index updated when scraper runs |
| Cost | Included with GitBook free plan | Free Algolia tier: up to 10 k records and 100 k operations/month; paid beyond those limits |
| Customization | Limited to theme‑based UI tweaks | Full API control: custom ranking, synonyms, faceting, UI components, and analytics |
| Maintenance | None required | Monitor scraper runs, watch Algolia quota, update config if site structure changes |
Trade‑offs
GitBook native search is the simplest path: no extra accounts, no extra steps, and zero cost. However, its relevance is limited to exact keyword matches, which can frustrate users when documentation contains synonyms or typos. Algolia DocSearch delivers instant‑as‑you‑type results, typo tolerance, faceting, and the ability to refine relevance through ranking rules and synonyms. The trade‑off is the need to create an Algolia account, configure and run the DocSearch scraper, and stay within the free‑tier limits (10 k records, 100 k operations/month). If the documentation exceeds those limits, a paid Algolia plan or index pruning becomes necessary.
Implementation Steps for Algolia DocSearch
- Create Algolia credentials: Sign up at algolia.com, create an application, and note the
Application IDand aSearch‑Only API Key. - Add the DocSearch plugin to
book.json:
Replace the placeholders with your actual values.{ "plugins": ["algolia-docsearch"], "pluginsConfig": { "algolia-docsearch": { "algoliaAppId": "YOUR_APP_ID", "apiKey": "YOUR_SEARCH_ONLY_API_KEY", "indexName": "YOUR_INDEX_NAME" } } } - Set up the DocSearch scraper: Use the official GitHub Action
docsearch/scraper@latest. Add a workflow file (e.g.,.github/workflows/docsearch.yml) that runs on pushes to the main branch:
Store the Algolia credentials as repository secrets (name: DocSearch Scraper on: push: branches: [ main ] jobs: scrape: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: docsearch/scraper@latest with: algolia_app_id: ${{ secrets.ALGOLIA_APP_ID }} algolia_api_key: ${{ secrets.ALGOLIA_API_KEY }} index_name: ${{ secrets.ALGOLIA_INDEX_NAME }} # optional: specify a custom config file if neededALGOLIA_APP_ID,ALGOLIA_API_KEY,ALGOLIA_INDEX_NAME). - Commit the generated index: The scraper outputs a
docsearch.jsonfile. Commit this file to the repository; the next GitBook deployment will pick it up. - Redeploy the GitBook site: Push the changes; GitBook will rebuild and serve the site with the Algolia‑powered search bar.
Verification
- Open the deployed GitBook site and confirm that the search bar appears in the header (it should show the Algolia logo or a customized placeholder).
- Enter a unique term that you know exists in a specific documentation page (e.g., a rare class name or a distinctive phrase). Observe the dropdown results: the expected page should appear with the query term highlighted.
- In the Algolia dashboard, navigate to Search → Logs. Verify that queries for your test term return a
200status and that the response includes hits from your index. - Check the Usage section to ensure the operation count stays within the free‑tier limits for your expected traffic.
Limitations and Practical Checks
- If your GitBook site is private or behind authentication, the DocSearch scraper cannot crawl it; you would need a custom indexing approach or remain with native search.
- The free Algolia tier limits the number of records. Periodically run
curl -X GET "https://YOUR_APP_ID-dsn.algolia.net/1/indexes/YOUR_INDEX_NAME/stats" -H "X-Algolia-Application-Id: YOUR_APP_ID" -H "X-Algolia-API-Key: YOUR_ADMIN_KEY"to inspect the record count and ensure it stays below 10 k. - Should you exceed the limits, consider either upgrading the Algolia plan or pruning the index (e.g., excluding low‑value pages via the scraper configuration).
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.