Chuyển đến nội dung
Skillpedia
Lập trình chung33k · #8723

algolia-search

Skill này làm gì

Skill này cho AI của bạn các mẫu xây dựng tìm kiếm nhanh với Algolia. Nó dành cho lập trình viên thêm tìm kiếm vào website hoặc ứng dụng.

Khi nào nên dùng

  • ✓Khi bạn muốn thêm tìm kiếm tức thì vào website React hoặc Next.js.
  • ✓Khi bạn cần giữ index tìm kiếm Algolia đồng bộ với dữ liệu của mình.
  • ✓Khi kết quả tìm kiếm không liên quan và bạn muốn tinh chỉnh chúng.

Liên kết skill

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/algolia-search/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/algolia-search/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy thêm tìm kiếm tức thì Algolia vào cửa hàng Next.js của tôi, với bộ lọc theo thương hiệu và giá.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill hướng dẫn agent về các hook InstantSearch, render phía máy chủ và chiến lược lập index. Agent áp dụng chúng vào dự án của bạn và chú ý các lỗi thường gặp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Algolia Search Integration

Patterns

React InstantSearch with Hooks

Modern React InstantSearch setup using hooks for type-ahead search.

Uses react-instantsearch-hooks-web package with algoliasearch client. Widgets are components that can be customized with classnames.

Key hooks:

  • useSearchBox: Search input handling
  • useHits: Access search results
  • useRefinementList: Facet filtering
  • usePagination: Result pagination
  • useInstantSearch: Full state access

Next.js Server-Side Rendering

SSR integration for Next.js with react-instantsearch-nextjs package.

Use <InstantSearchNext> instead of <InstantSearch> for SSR. Supports both Pages Router and App Router (experimental).

Key considerations:

  • Set dynamic = 'force-dynamic' for fresh results
  • Handle URL synchronization with routing prop
  • Use getServerState for initial state

Data Synchronization and Indexing

Indexing strategies for keeping Algolia in sync with your data.

Three main approaches:

  1. Full Reindexing - Replace entire index (expensive)
  2. Full Record Updates - Replace individual records
  3. Partial Updates - Update specific attributes only

Best practices:

  • Batch records (ideal: 10MB, 1K-10K records per batch)
  • Use incremental updates when possible
  • partialUpdateObjects for attribute-only changes
  • Avoid deleteBy (computationally expensive)

⚠️ Sharp Edges

Issue Severity Solution
Issue critical See docs
Issue high See docs
Issue medium See docs
Issue medium See docs
Issue medium See docs
Issue medium See docs
Issue medium See docs
Issue medium See docs
Câu hỏi thường gặp

Nó dùng những gói nào?

Nó dùng các gói react-instantsearch cùng client algoliasearch cho React và Next.js.

Tôi nên cập nhật index thế nào?

Skill khuyên dùng cập nhật tăng dần hoặc cập nhật một phần khi có thể, và gom bản ghi thành nhóm khoảng 1.000 đến 10.000.

Vì sao nên tránh deleteBy?

Skill cho biết deleteBy rất tốn tài nguyên tính toán, nên nên tránh khi có thể.

Chi tiết

Mô tả gốc của tác giả

Expert patterns for Algolia search implementation, indexing strategies, React InstantSearch, and relevance tuning Use when: adding search to, algolia, instantsearch, search api, search functionality.

repo: davila7/claude-code-templates

Độ phổ biến

Sao GitHub
33k
Vị trí xếp hạng
#8723
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự