Skip to content

feat(plugin-search): pass collection slug to beforeSync hook #11581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JianJroh
Copy link

@JianJroh JianJroh commented Mar 7, 2025

The following is the use case.

plugins: [
    searchPlugin({
      collections: ['products', 'posts'],
      beforeSync: ({ originalDoc, searchDoc,collectionSlug }) => {
        return {
          ...searchDoc,
          title: collectionSlug === 'products' ? originalDoc.name : originalDoc.title,
        }
      },
    }),
]

@JianJroh JianJroh force-pushed the feat/pass-collection branch from 8e1ab42 to 6114008 Compare March 11, 2025 07:39
@paulpopus
Copy link
Contributor

Thank you! Looks good, we'll get this merged

@github-actions github-actions bot added the stale label Apr 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants