Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

attributes_metadata contains too many attributes #383

Open
didkan opened this issue Feb 25, 2021 · 2 comments
Open

attributes_metadata contains too many attributes #383

didkan opened this issue Feb 25, 2021 · 2 comments

Comments

@didkan
Copy link

didkan commented Feb 25, 2021

version: 1.25.0

attributes_metadata contains data for attributes set to not be exported. This means we are exporting a lot of unnecessary data to ES.

For example.
I have set not to export product.weight:
image

Even so ES now contains the metadata for this attribute:
image

In total I have configured the indexer to export 22 product attributes (on top of the default exported ones), but attributes_metadata contains data for 85 attributes. And each item in attributes_metadata has at least 11 properties, so it is a pretty big chunk of data for each product.

This seems like a pretty big optimization possibility.

@didkan
Copy link
Author

didkan commented Feb 25, 2021

As you can see in the screenshot above I also tried to set is_visible_on_front to false.
Looking at the code this should be enough to not export the attribute:

$collection->addFieldToFilter(
[
'is_visible',
'is_visible_on_front',
],
[
['eq' => 1],
['eq' => 1],
]
);

But that doesn't seem to do anything?

Is it that BOTH is_visible_on_front and is_visible need to be false for the attribute to be ignored?

@didkan
Copy link
Author

didkan commented Feb 25, 2021

Looking again at this code:

$collection->addFieldToFilter(
[
'is_visible',
'is_visible_on_front',
],
[
['eq' => 1],
['eq' => 1],
]
);

It seems this code is filtering attributes with an OR condition, meaning:
if (is_visible || is_visible_on_front)

I would argue it should filter based on AND like:
if (is_visible && is_visible_on_front)
Or maybe just:
if (is_visible_on_front)

Or is there a reason I'm not understanding for this logic to use an OR condition?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant