babenkoivan / elastic-scout-driver-plus

Extension for Elastic Scout Driver
MIT License
267 stars 52 forks source link

Check that Scout driver is elastic before dispatching RemoveFromSearch #113

Closed keithbrink closed 2 years ago

keithbrink commented 2 years ago

Similar to my previous PR, there is an issue where the RemoveFromSearch event gets dispatched even when using a different Scout driver like collection in a test environment.

babenkoivan commented 2 years ago

Hey @keithbrink, I see the problem, but this package wasn't designed to be compatible with other Scout drivers (elastic-scout-driver should be used for this purpose). With elastic-scout-driver-plus you do search queries like this:

Model::searchQuery($query)->execute();

This interface is not supported by other drivers. How do you deal with this?

keithbrink commented 2 years ago

@babenkoivan I use a config check, same method as in this PR, since I can still call the default Scout search method.

No worries if you'd rather not merge this in, I understand if you'd rather keep the package opinionated. I can always maintain a fork.

babenkoivan commented 2 years ago

Hey @keithbrink, it is a low effort and probably helps in some cases so I've released v3.2.4 with a fix. It's done similarly to your solution, but if you have any issues with it please open an issue.