Posts in Results Duplicated Dozens of Times
-
I’ve encountered a weird issue recently where the search results are duplicated when this plugin is enabled. For example if I search for “hello search”, the first match is duplicated a dozen or so times in the search results. Disabling the plugin resolves the issue.
This only started happening recently and isn’t happening on my local or staging sites, only the production site. The few differences in the production site are things like object caching. Of course debugging the live site without access to a step debugger, etc is a bit tricky. Likewise disabling plugins on a busy live site isn’t fun either.
I’ve worked around the issue with this:
function cc_search_distinct($where) { if (is_search()) { return "DISTINCT"; } return $where; } add_filter('posts_distinct', 'cc_search_distinct');
That fixes the issue for me, but I’m not certain what changed in my setup where I suddenly need this. I suspect it has something to do with the
sql_distinct
function inact-better-search/src/Search/Request.php
but inspecting those conditions on the live site isn’t easy.
- The topic ‘Posts in Results Duplicated Dozens of Times’ is closed to new replies.