Skip to content
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

Have some respect for zeroooos! :D #2437

Closed
sheepfy opened this issue Feb 3, 2022 · 2 comments
Closed

Have some respect for zeroooos! :D #2437

sheepfy opened this issue Feb 3, 2022 · 2 comments
Assignees
Labels

Comments

@sheepfy
Copy link

sheepfy commented Feb 3, 2022

I have a decimal attribute, classic, normal one, people can edit it from admin, setting any numeric value on it.
Create a product, and set value of 0.0000 on that attribute. Or update catalog_product_entity_decimal tabel and set 0.0000 value for a product on that attribute.

After fulltext indexer is reindexed, you should notice that the attribute value is not present in elasticsearch.
In my case, attribute_code = weight_factor

select * from catalog_product_entity_decimal where attribute_id = 309 and entity_id = 225405;
image

vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Helper/AbstractAttribute.php
$value = array_filter($value); <- this line doesn't like the zeros

PS:
full es json response:

{
    "took": 0,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 1,
            "relation": "eq"
        },
        "max_score": 0.0,
        "hits": [
            {
                "_index": "magento2_default_catalog_product_20220203_122828",
                "_type": "_doc",
                "_id": "225405",
                "_score": 0.0,
                "_source": {
                    "sku": "XXXXXX",
                    "entity_id": "225405",
                    "weight_factor_2": [
                        0.0
                    ]
                }
            }
        ]
    }
}

full es request body:

{
    "query": {
        "bool": {
            "filter": [
                {
                    "term": {
                        "entity_id": "225405"
                    }
                }
            ]
        }
    },
    "_source": ["entity_id", "sku", "weight_factor", "weight_factor_2"]
}
@sheepfy sheepfy added the feature label Feb 3, 2022
@vahonc
Copy link
Collaborator

vahonc commented Feb 3, 2022

Hello @sheepfy,

We will look into this as we have other requests that are related to a similar issue.

BR,
Vadym

rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 13, 2022
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 13, 2022
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 14, 2022
to avoid boolean attributes facet coverage changing dramatically.
Also includes the ability to use admin sort to always display the "Yes"
value before the "No" in the layered navigation filter.
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 14, 2022
to avoid boolean attributes facet coverage changing dramatically.
Also includes the ability to use admin sort to always display the "Yes"
value before the "No" in the layered navigation filter.
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 14, 2022
to avoid boolean attributes facet coverage changing dramatically.
Also includes the ability to use admin sort to always display the "Yes"
value before the "No" in the layered navigation filter.
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 14, 2022
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 14, 2022
to avoid boolean attributes facet coverage changing dramatically.
Also includes the ability to use admin sort to always display the "Yes"
value before the "No" in the layered navigation filter.
rbayet added a commit that referenced this issue Mar 14, 2022
…ndexed_2.8.x

Feature #2437 Allow indexing 0 and false values (2.8.x)
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 14, 2022
to avoid boolean attributes facet coverage changing dramatically.
Also includes the ability to use admin sort to always display the "Yes"
value before the "No" in the layered navigation filter.
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 14, 2022
to avoid boolean attributes facet coverage changing dramatically.
Also includes the ability to use admin sort to always display the "Yes"
value before the "No" in the layered navigation filter.
rbayet added a commit to rbayet/elasticsuite that referenced this issue Mar 14, 2022
to avoid boolean attributes facet coverage changing dramatically.
Also includes the ability to use admin sort to always display the "Yes"
value before the "No" in the layered navigation filter.
@rbayet rbayet closed this as completed in 2e9948a Mar 14, 2022
rbayet added a commit that referenced this issue Mar 14, 2022
@rbayet
Copy link
Collaborator

rbayet commented Mar 15, 2022

Hello @sheepfy,

This has been adressed by #2482 (#2437)

A new per-attribute setting "Include zero or false values" is available to enable indexing and filtering (if set to Yes) on

  • false/No value of boolean attributes
  • 0 for integer/decimal attributes

image

For a boolean attribute, if set to Yes and the facet sort order is set to Admin Sort, both Yes and No values will be shown, with Yes in first position :
image

Regards,

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

No branches or pull requests

3 participants