Closed nickyharpor closed 3 years ago
@nickyharpor
Please can you confirm a few things:
Would you be able to install Query Monitor plugin and tell me what the queries are for the first search result and number of results. Then try searching something else and what the queries generated in that case are.
@ajaydsouza
Yes it only happens when cache is on. I disabled the cache in Better Search settings, and search worked as expected.
Yes, it is irrespective of the search term after the first search (when cache is on).
I installed Query Monitor. This is the main query for the first search which worked as expected with cache on:
SELECT SQL_CALC_FOUND_ROWS DISTINCT wp_posts.*,wp_posts.ID as ID, (MATCH(wp_posts.post_title) AGAINST ('book' ) * 10 ) + (MATCH(wp_posts.post_content) AGAINST ('book' ) * 1 ) as score
FROM wp_posts
LEFT JOIN wp_term_relationships AS bsq_tr
ON (wp_posts.ID = bsq_tr.object_id)
LEFT JOIN wp_term_taxonomy AS bsq_tt
ON (bsq_tr.term_taxonomy_id = bsq_tt.term_taxonomy_id)
LEFT JOIN wp_terms AS bsq_t
ON (bsq_t.term_id = bsq_tt.term_id)
WHERE 1=1
AND ( wp_posts.post_date <= '2021-11-06 08:35:02' )
AND wp_posts.ID NOT IN (8031,4827)
AND ((MATCH(wp_posts.post_title) AGAINST ('book' ) * 10 ) + (MATCH(wp_posts.post_content) AGAINST ('book' ) * 1 )
OR ( ((bsq_t.name LIKE '%book%')
OR (wp_posts.post_excerpt LIKE '%book%')) ) )
AND (wp_posts.post_password = '')
AND wp_posts.post_type = 'post'
AND ((wp_posts.post_status = 'publish'
OR wp_posts.post_status = 'inherit'))
ORDER BY score DESC
LIMIT 0, 10
For the second time, I searched 'rabbit', but there is no main query shown in the Query Monitor panel. Looks like it doesn't search it at all.
The second query would be pulling it out of the cache - it just is a get_posts call after a transients look up. But I think the issue here is that it’s pulling the same cache key. Let me dig into this to see if I can replicate it.
I've just tested and I can't duplicate this with seamless mode OFF but I think I can with seamless mode ON.
Can you confirm if you have seamless mode ON and if it works with seamless mode OFF?
I had seamless mode ON.
With seamless mode OFF, I can't reproduce this either.
I think I've fixed this. Could you please check this beta version? you can download the zip from there and upload it under Plugins > Add new
https://github.com/WebberZone/better-search/releases/tag/v3.0.3-beta1
Yes, it works without any problem with seamless mode and cache both ON. Thank you.
Thank you for confirming.
Fixed in: https://github.com/WebberZone/better-search/releases/tag/v3.0.3-beta1
Describe the bug Each time I change settings, search works for once. Then it's cached like forever, and for all users! Everyone get the same results as the first search.
To Reproduce Change plugin settings > search > search something else
Desktop and Smartphone
Additional context Latest wordpress and better search versions. I disabled better search plugin and everything worked as expected (i.e. search worked).