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
GraphQl Product visibility for search results #36623
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @Vasudev-22. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review. For more details, 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, join the Community Contributions Triage session to discuss the appropriate ticket. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run all unit tests |
Failed to run the builds. Please try to re-run them later. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@@ -122,7 +122,7 @@ public function build(array $args, bool $includeAggregation): SearchCriteriaInte | |||
} | |||
|
|||
$this->addEntityIdSort($searchCriteria); | |||
$this->addVisibilityFilter($searchCriteria, $isSearch, !empty($args['filter'])); |
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.
I think this logic doesn't make sense:
magento2/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php
Line 142 in 688a0b4
if ($isFilter && $isSearch) { |
If a search query is present it should always use getVisibleInSearchIds
and if it doesn't contain a search query it should use getVisibleInCatalogIds
. I don't think it makes sense to not filter anything. We are either in 'search mode' or in 'catalog mode' not in both?
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.
@paales , Which you mentioned this logic if ($isFilter && $isSearch) {
, is not related to this PR changes, it was available from core standards.
This PR is related to filter category conditions for catalog visibility combination $this->addVisibilityFilter($searchCriteria, $isSearch, !empty($args['filter']['category_id']));
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.
I don't think selecting by category_id is a valid condition:
- When searching for a keyword but filtering on a category_id it should still have visibility search? Or you could argue that each item should be in Search AND Catalog, but not neither?
- You only check on
category_id
but we've also gotcategory_uid
so, that should probably be changed.
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.
@paales I have checked in the codebase this build
method has been called from the below file
magento2/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php
Line 185 in cfaeeae
private function buildSearchCriteria(array $args, ResolveInfo $info): SearchCriteriaInterface |
And if from the query, someone is passing category_uid
then it is converted in category_id
through the below function call:
magento2/app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/Search.php
Line 190 in cfaeeae
$processedArgs = $this->argsSelection->process((string) $fieldName, $args); |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Functional Tests B2B |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Functional Tests CE, Functional Tests EE, WebAPI Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
This PR is already merged in d4a9791. Hence moving it to Recently merged. |
Description (*)
Product Visibility handling for search feature ,
Related Pull Requests
Fixes for #36591
Fixed Issues (if relevant)
Manual testing scenarios (*)
API-TEST-1
, has assigned a visibility as Catalog, so it will visible only with checking category condition.Questions or comments
Contribution checklist (*)