Defer to model's way of limiting the model set#292
Open
srlbarron wants to merge 2 commits intoalgolia:masterfrom
Open
Defer to model's way of limiting the model set#292srlbarron wants to merge 2 commits intoalgolia:masterfrom
srlbarron wants to merge 2 commits intoalgolia:masterfrom
Conversation
DevinCodes
requested changes
Jan 27, 2022
Contributor
DevinCodes
left a comment
There was a problem hiding this comment.
Thanks for this PR! Unfortunately, we can't move forward with this for the time being, please see my comment.
If you can open a PR on Laravel Scout to change the access level of the related method we could include this in a later version. WDYT?
| $instance->newQuery()->when($softDeletes, function ($query) { | ||
| $instance->newQuery() | ||
| ->when(true, function ($query) use ($instance) { | ||
| $instance->makeAllSearchableUsing($query); |
Contributor
There was a problem hiding this comment.
This currently fails, since makeAllSearchableUsing is not available to call outside of the class: it's defined as a protected method in Laravel Scout. As long as it's protected, we can't use this method here.
Author
There was a problem hiding this comment.
srlbarron
added a commit
to srlbarron/scout
that referenced
this pull request
Jan 27, 2022
Please see this PR: algolia/scout-extended#292
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will allow optimization per model
Avoid indexing models you don't want to be indexed anymore.
When the indexing process hits
shouldBeSearchableit is already iterating through a lot of "probably" unnecessary models.Describe your change
When using aggregators, this implelents
MakeAllSearchableindependently of how each model is implementing it.What problem is this fixing?
At the moment, this only looks for soft deletes in order to limit the set algolia needs to evaluate before indexing it.
With this change, the aggregator will look for a per model implementation of
MakeAllSearchableUsingin order for add extra rules to limit the set Algolia need to iterate to index.