Skip to content

Optimize loading in search indexers#2454

Merged
glennjacobs merged 8 commits into
lunarphp:1.xfrom
wychoong:patch-1
May 19, 2026
Merged

Optimize loading in search indexers#2454
glennjacobs merged 8 commits into
lunarphp:1.xfrom
wychoong:patch-1

Conversation

@wychoong

@wychoong wychoong commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

default loading is retrieving all fields of all variants
this changes only select only sku as only using sku in the indexer

could potentially breaking change if userland extended ProductIndexer and accessing other fields from $model->variants

TODO:

@wychoong

wychoong commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

@glennjacobs appreciate your input on this before working on it

@glennjacobs

Copy link
Copy Markdown
Contributor

@glennjacobs appreciate your input on this before working on it

As we encourage devs to make their own indexers, do you think this is important?

@wychoong

wychoong commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

@glennjacobs appreciate your input on this before working on it

As we encourage devs to make their own indexers, do you think this is important?

I think is the out of the box experience.
In my use case, I have a project is to sync data from external system, where a product can up to 500 variants, and on top of that it needs to merge a few products into single product in lunar. So when the catalog is huge and fetching a lot of data from relationships, the scout command just died halfway.

For now I replaced with own indexer, with the minor change as per this PR, because the default already good enough.

For the normal use case probably doesn’t feel it.

@glennjacobs

Copy link
Copy Markdown
Contributor

The breaking change is my concern here. I'm torn :-) I guess v1.5 is a big update, so what's one more breaking change?!

@wychoong

wychoong commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

The breaking change is my concern here. I'm torn :-) I guess v1.5 is a big update, so what's one more breaking change?!

I think it should be easy upgrade as long as documented.

Optimized for those using default. Those making their own would be a minor change in their custom indexer.

@glennjacobs

Copy link
Copy Markdown
Contributor

@wychoong I'm happy for you to finish up this PR

@wychoong

Copy link
Copy Markdown
Contributor Author

@wychoong I'm happy for you to finish up this PR

done, with the changelog updated lunarphp/docs#38

@wychoong
wychoong marked this pull request as ready for review May 19, 2026 04:59
@glennjacobs glennjacobs changed the title Optimize variants loading in ProductIndexer Optimize loading in search indexers May 19, 2026
@glennjacobs
glennjacobs merged commit c6808cd into lunarphp:1.x May 19, 2026
14 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Roadmap May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants