Skip to content

Optimize variants loading in ProductIndexer#2454

Draft
wychoong wants to merge 2 commits into
lunarphp:1.xfrom
wychoong:patch-1
Draft

Optimize variants loading in ProductIndexer#2454
wychoong wants to merge 2 commits into
lunarphp:1.xfrom
wychoong:patch-1

Conversation

@wychoong
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:

  • customer indexer
  • order indexer
  • document the changes in changelog

@wychoong
Copy link
Copy Markdown
Contributor Author

wychoong commented May 1, 2026

@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
Copy link
Copy Markdown
Contributor Author

wychoong commented May 1, 2026

@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
Copy link
Copy Markdown
Contributor Author

wychoong commented May 1, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants