Implemented Enhanced Search - Similar Thread Caching


Well-known member
For larger forums with millions of threads, it would be very helpful to have similar thread caching for results (i.e. cache similar threads for 30 days) - ideally using a field in the xf_thread database, so that it works for long term caching. There are millions of threads which are old and still useful, but using ES to search for similar threads each time the thread is viewed would add a large overhead (especially when lots of different old threads are viewed).
Upvote 0
This suggestion has been implemented. Votes are no longer accepted.
This is what it does -- there's a table xf_es_thread_similar that holds this information. The results are cached for 14 days by default, though the flag to refresh this only happens when threads are viewed (so it doesn't end up refreshing every thread every 14 days).

Cache refreshes are done in the background, though the first trigger is done in the foreground. This is primarily so that when a new thread is posted we immediately have similar threads displayed.
Had a question about 14 day caching. What happens if a thread included in the cache is deleted in that 14 day period? (Plus can this be configured? Tbh 14 days seems like a bit much. Would find out soon though!).

I am using Andy's add-on on 2.1 and it does not use caching. Every page load is hitting XFES I guess. Based on the fast increasing number in the XFES control panel.
Thanks. So I assume 14 day is not configurable from backend (would be doing a test installation of 2.2 later tonight). I hope someone would release an add-on to customize this setting!
So did some testing on this today. I deleted a thread from similar threads section of another thread. Xenforo replaced that thread with another thread. I wonder if this is desired behavior... Or caching is somehow not working on my board?
You can clear the cache by ticking the box in the Elasticsearch setup page and saving, if that's what you mean.
Top Bottom