adobe / aem-core-cif-components

A set of configurations and components to get you started with AEM Commerce development
Apache License 2.0
103 stars 80 forks source link

CIF-2919: allow to enforce POST requests for customAttributeMetadata query #927

Closed buuhuu closed 2 years ago

buuhuu commented 2 years ago

Description

With catalogs that have a lot of custom product attributes the customAttributeMetadata query executed by the SearchFilterServiceImpl for Product Lists and Search Results may exceed the query parameter limit of http GET requests. Using POSTs for the GraphqlClient in question will resolve the issue but is not recommended as it by-passes any CDN caching that may be involved.

With this change we allow the CIF Search Filter Service to be configured to enforce POST only for the customAttributeMetadata query. The option is per default disabled. If enabled we recommend to cache the response by configuring the GraphqlClient caching accordingly.

Related Issue

CIF-2919

Motivation and Context

How Has This Been Tested?

Unit tests

Screenshots (if appropriate):

Types of changes

Checklist:

codecov[bot] commented 2 years ago

Codecov Report

Merging #927 (e5fbc2b) into master (e497022) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master     #927      +/-   ##
============================================
+ Coverage     89.73%   89.74%   +0.01%     
- Complexity     2018     2020       +2     
============================================
  Files           338      338              
  Lines          9261     9265       +4     
  Branches       1318     1319       +1     
============================================
+ Hits           8310     8315       +5     
+ Misses          678      677       -1     
  Partials        273      273              
Flag Coverage Δ
integration 52.83% <60.00%> (-0.01%) :arrow_down:
jest 86.38% <ø> (ø)
karma 95.68% <ø> (ø)
unittests 88.86% <100.00%> (+0.02%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rch/internal/services/SearchFilterServiceImpl.java 88.52% <100.00%> (+0.80%) :arrow_up:
...ents/internal/client/MagentoGraphqlClientImpl.java 96.75% <0.00%> (+0.64%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e497022...e5fbc2b. Read the comment docs.

kungaba commented 2 years ago

@Buuhuu - I have verified this change in my commerce setup which is running very long customAttributeMetadata query. I don't see any 414 errors in the log after I deployed this change and enabled the enforcePost checkbox in the config. This is good to go.