Skip to content

feat: meilisearch rework - #526

Open
andrey-hrinchenko wants to merge 2 commits into
masterfrom
feat-meilisearch-rework
Open

feat: meilisearch rework#526
andrey-hrinchenko wants to merge 2 commits into
masterfrom
feat-meilisearch-rework

Conversation

@andrey-hrinchenko

@andrey-hrinchenko andrey-hrinchenko commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

https://app.notion.com/p/Meilisearch-accuracy-38b36e86b6ce8058b24beb4645c45b6d?d=7e936e86b6ce82899caa8311cf77f58d&source=copy_link

Summary by CodeRabbit

  • New Features
    • Added Meilisearch administration with configurable search profiles, synchronisation controls, service status, and search testing.
    • Added autocomplete results for products, categories, brands, and content.
    • Product searches now support variant-specific titles, links, and initial variant selection.
    • Added content indexing for published articles and pages.
  • Improvements
    • Catalogue search now supports profile-specific settings, improved ranking, facets, sorting, and resilient fallback results.
    • Search indexes are synchronised automatically on a regular schedule.
  • Bug Fixes
    • Improved autocomplete visibility and request handling for empty or short queries.

@vercel

This comment was marked as spam.

@coderabbitai

This comment was marked as spam.

@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR reworks Meilisearch-backed catalog and content search.

  • Adds configurable search profiles, administration endpoints, synchronization jobs, and index management.
  • Adds storefront autocomplete across products, categories, brands, articles, and pages.
  • Adds variant-aware product search links and selection.
  • Adds a bounded Medusa catalog fallback when Meilisearch is unavailable.
  • Fixes the previously reported content-document deletion ID and fallback pagination metadata mismatches.

Confidence Score: 5/5

The PR appears safe to merge based on the eligible follow-up findings.

No blocking failure remains; the content-removal path now targets the indexed underscore-delimited ID, and degraded catalog responses use the database query count to preserve pagination.

Important Files Changed

Filename Overview
apps/medusa-be/src/modules/meilisearch/content-events.ts Reconciles CMS publication changes with content indexes and now uses the same underscore-delimited document ID as normal indexing.
apps/medusa-be/src/modules/meilisearch/documents.ts Builds normalized product and content search documents, including stable content IDs and storefront links.
apps/medusa-be/src/api/store/catalog/products/route.ts Implements profile-backed catalog search and now derives degraded-mode pagination from Medusa query metadata.
apps/medusa-be/src/modules/meilisearch/synchronize.ts Implements full and incremental synchronization of profile-specific search indexes.
apps/medusa-be/src/api/store/search/autocomplete/route.ts Adds multi-index autocomplete results for products, taxonomy entities, and CMS content.
apps/herbatika/src/components/search-results.tsx Extends the search page with related category, brand, and content results alongside product listings.
apps/herbatika/src/components/product-detail/use-product-detail-data.ts Selects a requested search-result variant on product-detail initialization while retaining first-variant fallback behavior.

Sequence Diagram

sequenceDiagram
  participant CMS as Payload CMS
  participant API as Medusa Backend
  participant Meili as Meilisearch
  participant Store as Herbatika Storefront
  CMS->>API: Content change webhook
  API->>Meili: Add or remove content document
  Store->>API: Catalog or autocomplete query
  API->>Meili: Search configured profile indexes
  Meili-->>API: Ranked products and related entities
  API-->>Store: Products, facets, pagination, and suggestions
  alt Meilisearch unavailable
    API->>API: Query bounded Medusa catalog fallback
    API-->>Store: Degraded response with database count
  end
Loading

Reviews (2): Last reviewed commit: "fix: meilisearch rework" | Re-trigger Greptile

Comment thread apps/medusa-be/src/modules/meilisearch/content-events.ts Outdated
Comment thread apps/medusa-be/src/api/store/catalog/products/route.ts Outdated
@github-actions

This comment was marked as low quality.

coderabbitai[bot]

This comment was marked as low quality.

coderabbitai[bot]

This comment was marked as low quality.

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.

1 participant