You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just switched from my theme to Twenty Twenty Two to debug something and I noticed that the search results really didn't seem to be in the correct order, so I used the Debug Bar ElasticPress to inspect the query and results.
It turns out that it is running two queries, and the only difference between the two is that the first shows:
Inspecting the results, I can see that the first query is ordered appropriately. Evidently it is being replaced by the 2nd.
From some basic step debugging with xdebug, I can see that the first query triggers the ep_set_sort filter, though it defaults to _score anyway.
The 2nd query doesn't get there, because $args['orderby'] is not empty.
Here are the callstacks
Query 1
Query 2
It looks like the first query is called in the initial \wp-blog-header.php -> wp() process and then when that completes, it goes through the motions again with require_once ABSPATH . WPINC . '/template-loader.php'; at the end of that file.
Disabling all plugins except for Debug Bar and ElasticPress doesn't fix it. If I switch back to my theme or Twenty Twenty-One, only one score-sorted query happens. If I remove search blocks from the pages in 2022, that doesn't help.
I'm not smart enough to know/figure out if this is a problem inherent to ElasticPress, Gutenberg, 2022 theme, Block Themes in general, etc... But I hope this is useful information!
Steps to Reproduce
Activate Twenty Twenty-Two theme
Activate Debug Bar and Debug Bar ElasticPress
Do a search.
Check the queries and results.
Expected behavior
One query, sorted by Score.
Environment information
Device: Linux VPS
OS: Ubuntu 20.04
Browser and version: Microsoft Edge
WordPress version: 5.9.3
ElasticPress version: 4.10
Elasticsearch version: 7.17.3
Where do you host your Elasticsearch server? Self Hosted (localhost)
What ElasticPress features do you have currently active? Still happens even with only Posts active.
Plugins and version: As explained, it happens with them all disabled.
Theme and version: Twenty Twenty-Two 1.1
The text was updated successfully, but these errors were encountered:
I just switched from my theme to Twenty Twenty Two to debug something and I noticed that the search results really didn't seem to be in the correct order, so I used the Debug Bar ElasticPress to inspect the query and results.
It turns out that it is running two queries, and the only difference between the two is that the first shows:
and the second shows
Inspecting the results, I can see that the first query is ordered appropriately. Evidently it is being replaced by the 2nd.
From some basic step debugging with xdebug, I can see that the first query triggers the
ep_set_sort
filter, though it defaults to_score
anyway.The 2nd query doesn't get there, because
$args['orderby']
is not empty.Here are the callstacks
Query 1
Query 2
It looks like the first query is called in the initial
\wp-blog-header.php -> wp()
process and then when that completes, it goes through the motions again withrequire_once ABSPATH . WPINC . '/template-loader.php';
at the end of that file.Disabling all plugins except for Debug Bar and ElasticPress doesn't fix it. If I switch back to my theme or Twenty Twenty-One, only one score-sorted query happens. If I remove search blocks from the pages in 2022, that doesn't help.
I'm not smart enough to know/figure out if this is a problem inherent to ElasticPress, Gutenberg, 2022 theme, Block Themes in general, etc... But I hope this is useful information!
Steps to Reproduce
Expected behavior
One query, sorted by Score.
Environment information
The text was updated successfully, but these errors were encountered: