ElasticPress
ElasticPress copied to clipboard
Custom Search Result, Date decay, and result sets larger than the posts per page number
Is your enhancement related to a problem? Please describe.
Currently, if the administrator sets a custom search result and has date decay enabled, the results can be wrongly ordered if the number of posts returned is larger than the number of posts displayed per page.
Although we add terms.ep_custom_result.name^9999 to the query, to boost custom search results, for older documents the score is lowered by the date decay. That is not a problem for small result sets because the plugin reorders the results in Feature\SearchOrdering::posts_results(). That can't happen when the post is on the following page though.
Steps to reproduce
- Enable
Weight results by dateunderPost Searchon the Features page - Create a post titled
Post about flowersand set its date to 10 years ago - Create a post titled
Post about treesand also set its date to 10 years ago - Create a post titled
Post about gardenswith the current date - Create a Custom Search Result to
gardensand set the flowers and trees posts to be displayed first - Set WordPress to only display 2 posts per page
- Search for
gardensand see thePost about gardensbeing displayed on the first page