How to extend graphql query search arguments
Hi,
I'm trying to extend the CIF product list component but I have some problems in customizing the GraphQL query.
I've extended the ProductList model and added custom fields in the query as explained also in this video and guide:
- https://www.youtube.com/watch?v=sOVtXt-xx4c&t=2s
- https://experienceleague.adobe.com/docs/experience-manager-65/commerce/storefront/developing/customize-cif-components.html
I have also the need to modify the query search arguments with a custom criteria, but I really can't find a guide or an example to do this without having to rewrite the entire component model.
To be more specific, I need to edit the "searchArgs" that are here (SearchResultsServiceImpl) used to generate the graphQL query:
Operations.query(query -> query.products(searchArgs, queryArgs)).toString();
Do I need to write a custom function like "fetchProducts" and build from scratch a product retriever?
Or is there a way to customize the existing query like I've done for the returned attribute set with
.addCustomObjectField and .addCustomSimpleField?
To achieve what I need I've edited the CIF components source code and it works, but it seems like an extreme solution to a maybe more simpler problem