0

我有个问题。我正在使用ProductAttributeFacetedSearchSearchModel构建FacetedSearchExpression,但在结果集中我只看到 skucount并且productCount为空。如何开启它?

public FacetedSearchExpression<ProductProjection> createFacet(ProductAttributeFacetedSearchSearchModel productSearchModel) {
        final String attributeName = getFacetModel().getAttributeName();
        final String attributeValue = getFacetModel().getAttributeValue();
        return productSearchModel.ofBoolean(attributeName).is(attributeValue);
    }

我从 CT 获得的 Json,用于搜索,我使用 ofBoolean() 按布尔属性进行搜索:

{
    "facetResults": [
        {
            "type": "terms",
            "missing": 903,
            "total": 903,
            "other": 0,
            "terms": [
                {
                    "term": "true",
                    "count": 713,
                    "productCount": null
                },
                {
                    "term": "false",
                    "count": 190,
                    "productCount": null
                }
            ]
        }
    ]
}
4

1 回答 1

0

感谢您分享您的问题。您是否查看过此主题的平台文档?在方面条款下,您可以看到产品计数仅在启用产品计数时可用。

https://docs.commercetools.com/http-api-projects-products-search#facetterm

如果您仍然遇到困难,如果您可以提供您正在使用的查询示例和您收到的响应正文,将会很有帮助。

于 2019-12-18T16:02:05.780 回答