payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
29.14k stars 1.81k forks source link

Search Plugin - issue when deleting same id but from different collections #9612

Closed ogaraud closed 3 days ago

ogaraud commented 4 days ago

Describe the Bug

I have two collections 'Contact' and 'Post', when I use the search plugin and try to delete content with the same ID, only the last one is deleted and not the right one.

Results Page on init:

Image

Elements with the same ID:

Image

Image

Search results after deleting 'Post' content:

Image

Error when you click on the content:

Image

Link to the code that reproduces this issue

https://github.com/ogaraud/payload-search-plugin-bug/tree/search-plugin-bug/test/_community

Reproduction Steps

(I use postgres db)

Which area(s) are affected? (Select all that apply)

plugin: search

Environment Info

Binaries:
  Node: 22.11.0
  npm: N/A
  Yarn: N/A
  pnpm: 9.14.2
Relevant Packages:
  payload: 3.2.1
  next: 15.0.0
  @payloadcms/db-postgres: 3.2.1
  @payloadcms/email-nodemailer: 3.2.1
  @payloadcms/graphql: 3.2.1
  @payloadcms/next/utilities: 3.2.1
  @payloadcms/payload-cloud: 3.2.1
  @payloadcms/plugin-nested-docs: 3.2.1
  @payloadcms/plugin-search: 3.2.1
  @payloadcms/richtext-lexical: 3.2.1
  @payloadcms/translations: 3.2.1
  @payloadcms/ui/shared: 3.2.1
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
github-actions[bot] commented 2 days ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.