-
Notifications
You must be signed in to change notification settings - Fork 215
Description
Hi,
I am implementing commerce search using Connect API
Rest Connect API
Apex Connect API
Unfortunately I cannot filter search results by picklist field value.
B2B Commerce on Lightning Doc states that picklist type is supported.
This is a sample of my code:
`
CommerceSearchDomain.SearchProductsWrapper searchProductsWrapper = new CommerceSearchDomain.SearchProductsWrapper();
searchProductsWrapper.webstoreId = input.webstoreId;
searchProductsWrapper.productSearchInput = new ConnectApi.ProductSearchInput();
searchProductsWrapper.productSearchInput.pageSize = APP_CommerceCatalogAPI.DEFAULT_SEARCH_PRODUCTS_SIZE;
searchProductsWrapper.productSearchInput.page = input.pageNumber;
searchProductsWrapper.productSearchInput.searchTerm = input.searchTerm;
ConnectApi.DistinctValueRefinementInput refinementInput = new ConnectApi.DistinctValueRefinementInput();
refinementInput.values = new List<String>{'HE'};
refinementInput.nameOrId = 'Orders_3__c';
refinementInput.type = ConnectApi.CommerceSearchFacetType.DistinctValue;
refinementInput.attributeType = ConnectApi.CommerceSearchAttributeType.Custom;
searchProductsWrapper.productSearchInput.refinements = new List<ConnectApi.RefinementInput>{refinementInput};
`
Running SOQL as B2B user returns Product records with correct value in specified field.
But commerce search returns an empty response whenever I try to specify value in Refinement. For empty refinements list it returns every record (accessible by user).
I tried to check other fields and using Checkbox field gives proper results from the Webstore Search.
Before using fields as search filters I configure commerce setup and rebuild search index

Any ideas what is missing in my code or configuration? Anyone had this issue before?
