-
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
queueRemoveFromSearch() should optionally use a queue #331
Comments
I kind of agree with you on this one. Possible code for a Pull Request: /**
* Dispatch the job to make the given models unsearchable.
*
* @param \Illuminate\Database\Eloquent\Collection $models
* @return void
*/
public function queueRemoveFromSearch($models)
{
if ($models->isEmpty()) {
return;
}
if (! config('scout.queue')) {
return $models->first()->searchableUsing()->delete($models);
}
dispatch((new RemoveFromSearch($models))
->onQueue($models->first()->syncWithSearchUsingQueue())
->onConnection($models->first()->syncWithSearchUsing()));
} @driesvints What do you think about this? |
@nunomaduro looks good. |
Thanks @driesvints. I gonna work on a Pull Request on the next couple days. Edit: I don't really have time for this right now. |
I just found out today that unsearchable() does not use queue. This PR will fix my issue. Thanks |
I am trying to implement this with the code suggested by @nunomaduro. We will dispatch a job Any suggestions how to get around this? |
I think that it why queueing deletes was initially removed in this commit f46b2b8 |
Yes. This limitation makes sense. It might be possible to obtain the relevant keys for deletion using Knowing which Scout engine to use for the model class being deleted may also need to be persisted if that information isn't easily available at the job's execution time. *Edit: After looking at the |
Any update on this, It was really confusing looking at the code to find out it doesn't actually queue. |
This bit me today. I'm using the TNTSearch driver and have a very large search index. Even though I have a dedicated scout queue, this method is being run in sync has causing 4-5s delays in my code. This really ought to be given a higher priority. |
Anyone's free to send in a pr for this enhancement. |
I have this working on a branch but it's a bit of a hack. It only works if the scout driver only accesses Given these limitations I'm not sure if I should open a PR. Maybe it should be optional? |
@matt-allan I think it's fair to pursue a solution for only the Algolia driver since that's the only one we're supporting natively in the library atm. But if there would be a generic solution to this we can definitely improve it further later on so other third party libraries can benefit as well. |
@matt-allan I just wanted to ping you about your branch. I think you should submit a PR for the Algolia support. It seems like you have enough buy-in. |
Thanks @chamby and @driesvints, I'll see if I can make some time to get the PR ready next week. |
@matt-allan I've tackled the remaining issues. Feel free to send that PR for this one if you like! :) |
Hey guys, any idea about when this will be released? |
@fernandocoronatomf please don't post "when will this be released" comments. Those aren't helpful. Instead, feel free to help out by sending in a PR. |
2 year ? |
@uyson please send in a PR if you want this to move forward. |
yes, I tring to do . but I need to learn phpunit, and mockry to write a test |
我看了代码, 原来的基础场不好改, 搜两年了我很郁闷官方也没有修改的想法? |
This will finally land in today's Scout release thanks to @stevebauman 👏 |
Engine delete operations, much like update operations, invoke the network and add latency. I would expect
Searchable::queueRemoveFromSearch()
to optionally use a queue just likeSearchable::queueMakeSearchable()
does. It even has queue in the name.A new Job called
MakeUnsearchable
would also need to be created.The text was updated successfully, but these errors were encountered: