-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Allow to cache search results #30340
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
Allow to cache search results #30340
Conversation
Hi @alinalexandru. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @alinalexandru. Thank you for your collaboration. From my point of view, we cannot allow all /catalogsearch
pages to be cached by Varnish since this behavior goes against the idea of "Cacheable Search Terms". If we allow caching 100 popular items it applies only to the limited amount of pages.
$this->getCacheableResult($catalogSearchHelper, $query, $handles); |
If we allow Varnish to cache /catalogsearch
URLs, it may affect not only "popular" search terms but all search pages. Considering the fact that we may have an infinite number of different catalog search queries in the URL, it may be a good way to overflow the Varnish storage.
Please, correct me if I'm wrong.
@rogyar Magento will be in charge to decide if that page can be cached or not. In the current implementation, the search result page can be cached only if it's a popular search and it doesn't have any other get parameters. You can see what happens if the page should not be cached:
|
@rogyar |
Hi @alinalexandru. Not it totally makes sense. Thanks a lot for the explanation and examples. |
@magento run all tests |
Hi @rogyar, thank you for the review. |
@alinalexandru thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
@magento create issue |
✔️ QA Passed Case 1Manual testing scenario:
Before: ✖️ The search page is not cached. After: ✔️ The search page was delivered from the cache Case 2Manual testing scenario:
After: ✔️ Only 2 search queries were cached, all subsequent queries are not |
Hi @alinalexandru, thank you for your contribution! |
Description (*)
Starting version 2.2.4, search result page can be cached, but varnish vcl has a rule to not cache the page.
Manual testing scenarios (*)
Number of top search results to cache
to 0 (this will set to cache all the results)Actual result:
Expected result:
Contribution checklist (*)
Resolved issues: