Skip to content
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

Update an item creates a new record #8

Open
itsam opened this issue Nov 23, 2023 · 3 comments
Open

Update an item creates a new record #8

itsam opened this issue Nov 23, 2023 · 3 comments

Comments

@itsam
Copy link

itsam commented Nov 23, 2023

Hello, first of all thank you for your effort.

There are the following cases that triggers indexing

  1. When a new item is created: Everything works as expected and the item correctly is getting indexed
  2. When an existing item is deleted: Everything works as expected. The item is deleted from typesense server
  3. When an existing item is updated. The problem here is that a new "identical" index is created (which is wrong).

Sneaking a little bit I believe the problem is on Module.php and specifically to
public function updateSearchIndex(Event $event): void

Any help or idea would be appreciated. Thanks in advance

@itsam
Copy link
Author

itsam commented Nov 25, 2023

It seems that the problem occurs ONLY after the items are re-indexed. If no re-index is triggered then no duplicates are occuring.
The reason for that is after re-indexing, the indexed items got a different "resource_id" (which is now different than the "id") and thus a NEW item is created where id and resource_id are the same...

I am not sure why you are using the resource_id in Modules.php though... isn't just "id" enough?
Hope that helps

@joeirimpan
Copy link
Member

Ah you are right. We got hit by this bug and could not find time to fix it. I will be taking a look at this towards the 2nd week of Dec as I'm dealing with some personal stuff right now.

@itsam
Copy link
Author

itsam commented Nov 25, 2023

@joeirimpan Thank you for your reply.
It seems that I have fix it.
I can provide a pull request if you like

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

No branches or pull requests

2 participants