-
Notifications
You must be signed in to change notification settings - Fork 340
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
[10.x] Fix custom scout keys not being utilized when deleting from queue #657
[10.x] Fix custom scout keys not being utilized when deleting from queue #657
Conversation
…and resolve deleting with custom key
…ut key is a string
…out-collection-master
Thanks @stevebauman. I'll use this PR as a reference once 9.x is updated and I merge it into master. |
@stevebauman @mmachatschek I've merged 9.x into master now but unsure if everything is now okay. If you have the time, can you maybe check if everything looks in order? Looks like this PR is also conflicting now. Here's my merge commit: 0337e4c |
Hey @driesvints, thanks for the ping! I'll review in a couple hours today and comment back 👍 |
@driesvints Okay I've completed reviewing and have updated my PR with master. I have removed the Lines 388 to 391 in 8489fac
In v10, this was adjusted to return only the key name instead (i.e. Lines 390 to 393 in 0337e4c
This should not cause any side-effects for those upgrading to v10. Lines 247 to 249 in 8489fac
However, if a developer has overrode // app/Models/Post.php
public function getScoutKeyName()
{
return 'posts.id';
} Then they must update their formatting to return only the DB column itself, excluding the DB table to maintain compatibility with the v10 update: public function getScoutKeyName()
{
- return 'posts.id';
+ return 'id';
} Let me know if there's anything else I can help with! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good @stevebauman. Thank you for your work on this!
Hi @stevebauman - I see this is sent to |
Hey @taylorotwell, I can definitely do that, but I'm leaving my home for the weekend. I'll be able to write something up on Monday! 👍 |
OK - mark as ready for review when that is done. Thanks! |
Okay I've done a run though. There are two breaking changes here:
This method was introduced in v9 in a PR I wrote (#656) to prevent logic duplication of retrieving the key name from the fully qualified key name that was being returned from the
The public function getScoutKeyName()
{
- return 'posts.id';
+ return 'id';
} This is because this method is now being used in the built-in search engine implementations (such as to store the models primary key in the indexed record), where it was not being used previously. Ex: MeiliSearch Before: scout/src/Engines/MeiliSearchEngine.php Line 69 in 2bc384e
MeiliSearch After: scout/src/Engines/MeiliSearchEngine.php Line 69 in 0337e4c
Developers that have not overridden the Let me know if you have any further questions or would like me to tackle additional related tasks! |
Related #656
Sending this in for tests to run and ensure everything passes with the recent changes of the above PR. 👍