Skip to content
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

Open
wants to merge 2 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

Vasudev-22
Copy link
Contributor

Description (*)

Product Visibility handling for search feature ,

Related Pull Requests

Fixes for #36591

Fixed Issues (if relevant)

  1. Fixes GraphQL product visibility isn't handled correctly for search results #36591

Manual testing scenarios (*)

  1. SKU API-TEST-1, has assigned a visibility as Catalog, so it will visible only with checking category condition.
    Admin
  2. Result won't be appear if we search this sku.
    Search_without_filter
  3. Result will appear by checking the combination of assigned category and search key word
    Search_with_filter

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Dec 16, 2022

Hi @Vasudev-22. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

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.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 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

@m2-community-project m2-community-project bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Dec 16, 2022
@m2-community-project m2-community-project bot added this to Pending Review in Pull Requests Dashboard Dec 16, 2022
@Vasudev-22
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

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.

@Vasudev-22
Copy link
Contributor Author

@magento run all unit tests

@magento-automated-testing
Copy link

Failed to run the builds. Please try to re-run them later.

@Vasudev-22
Copy link
Contributor Author

@magento run all tests

@magento-automated-testing
Copy link

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']));
Copy link
Contributor

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:

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?

Copy link
Contributor Author

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']));

Copy link
Contributor

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 got category_uid so, that should probably be changed.

Copy link
Contributor

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

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:

$processedArgs = $this->argsSelection->process((string) $fieldName, $args);

@m2-community-project m2-community-project bot moved this from Pending Review to Review in Progress in Pull Requests Dashboard Jan 6, 2023
@m2-community-project m2-community-project bot added Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. labels May 22, 2023
@engcom-Lima engcom-Lima removed the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Jun 7, 2023
@engcom-Lima
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

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.

@engcom-Lima
Copy link
Contributor

@magento run Functional Tests B2B

@magento-automated-testing
Copy link

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.

@engcom-Lima
Copy link
Contributor

@magento run Functional Tests CE, Functional Tests EE, WebAPI Tests

@magento-automated-testing
Copy link

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.

@m2-community-project m2-community-project bot moved this from Review in Progress to Ready for Testing in Pull Requests Dashboard Jun 9, 2023
@engcom-Charlie
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

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.

@engcom-Charlie
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

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.

@engcom-Echo engcom-Echo moved this from Merge in Progress to Recently Merged in Community Dashboard Jul 17, 2023
@engcom-Lima engcom-Lima moved this from Recently Merged to Merge in Progress in Community Dashboard Sep 1, 2023
@m2-community-project m2-community-project bot moved this from Merge in Progress to Recently Merged in Community Dashboard Sep 1, 2023
@m2-community-project m2-community-project bot moved this from Recently Merged to Merge in Progress in Community Dashboard Sep 1, 2023
@engcom-Lima engcom-Lima moved this from Merge in Progress to Recently Merged in Community Dashboard Sep 1, 2023
@engcom-Lima engcom-Lima moved this from Recently Merged to Merge in Progress in Community Dashboard Sep 7, 2023
@engcom-Lima engcom-Lima moved this from Merge in Progress to Recently Merged in Community Dashboard Sep 7, 2023
@m2-community-project m2-community-project bot moved this from Recently Merged to Merge in Progress in Community Dashboard Sep 7, 2023
@m2-community-project m2-community-project bot moved this from Merge in Progress to Recently Merged in Community Dashboard Sep 7, 2023
@mrtuvn mrtuvn moved this from Recently Merged to Merge in Progress in Community Dashboard Oct 16, 2023
@engcom-Charlie
Copy link
Contributor

This PR is already merged in d4a9791. Hence moving it to Recently merged.

@engcom-Charlie engcom-Charlie moved this from Merge in Progress to Recently Merged in Community Dashboard Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Project: Community Picked PRs upvoted by the community
Projects
Community Dashboard
Recently Merged
Development

Successfully merging this pull request may close these issues.

GraphQL product visibility isn't handled correctly for search results
8 participants