ElasticPress icon indicating copy to clipboard operation
ElasticPress copied to clipboard

Add support for random ordering with seeds

Open asharirfan opened this issue 6 years ago • 3 comments

Description of the Change

This PR adds support for using RAND function in the orderby field for search queries.

Checklist:

  • [x] I have read the CONTRIBUTING document.
  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my change.
  • [ ] All new and existing tests passed.

Applicable Issues

#1490

Changelog Entry

  • Add support for RAND function for orderby field in search queries.

asharirfan avatar Jan 21 '20 16:01 asharirfan

Looks like this is already supported. What does this PR do?

tlovett1 avatar Feb 20 '20 16:02 tlovett1

Looks like this is already supported. What does this PR do?

@tlovett1 Right now, only 'orderby' => 'rand' is supported. This PR adds the support for the RAND function which lets a user pass seed value to the function.

You can read more about it over here: https://github.com/10up/ElasticPress/issues/1490#issuecomment-576351214

asharirfan avatar Feb 21 '20 16:02 asharirfan

@brandwaffle I have added the test in f70ee87db9ac22d0d4c11ef7c67a527318153aa4 Can we do cherry-pick after the merge this PR?

mustafauysal avatar Feb 22 '20 18:02 mustafauysal