-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Issue 31043: Elastic Search interferes with the default sort order of products (changing newest first to oldest first) #36900
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
base: 2.4-develop
Are you sure you want to change the base?
Conversation
Hi @rogerdz. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@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 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 give me test instance |
Hi @rogerdz. Thank you for your request. I'm working on Magento instance for you. |
Hi @rogerdz, here is your Magento Instance: https://a961f7d4071fdb23cce8cdfa12c1651a.instances.magento-community.engineering |
@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 give me test instance |
Hi @Viper9x. Thank you for your request. I'm working on Magento instance for you. |
Hi @Viper9x, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later. |
@magento give me test instance |
Hi @Viper9x. Thank you for your request. I'm working on Magento instance for you. |
Hi @Viper9x, here is your Magento Instance: https://a961f7d4071fdb23cce8cdfa12c1651a.instances.magento-community.engineering |
@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 Functional Tests B2B, Functional Tests CE , Functional Tests EE |
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 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. |
@rogerdz Could you please resolve conflict? |
Hello @rogerdz, We request you to please resolve the conflicts on this PR, so that we can proceed further with this. Meanwhile moving this PR Thanks |
…anging newest first to oldest first)
@magento run all tests |
@magento run all tests |
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.
Pull Request Overview
The pull request updates the default fallback sort order in the product fulltext collection to use descending product IDs.
- Changed the default entity_id sort from ascending to descending.
- Ensures newer products appear first when no other sort is specified.
Comments suppressed due to low confidence (2)
app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php:584
- No tests appear to cover the updated fallback sort order. Consider adding or updating unit/integration tests to validate that products are sorted by entity_id descending when using this collection.
$this->setOrder('entity_id', Select::SQL_DESC);
app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php:581
- The doc block above the sort change should mention that the fallback order is now set to entity_id descending to reflect the new behavior.
* NOTE: this does not replace existing orders but ADDs one more
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.
Hello @rogerdz,
The changes seems good to us, but please refer to the below review comments:
- It seems some automated tests are failing due to the changes
- Consider making the default sort order configurable if different deployments require different behaviors.
- Add/modify an integration test to assert search results default to descending order by entity_id.
- Update the comment above the line to specify "newest first" for clarity.
Description (*)
Add sorting condition by product id desc
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)