- Issue created by @ericgsmith
- 🇳🇿New Zealand ericgsmith
I'm not sure if other search api backends recommend disabling views caching - perhaps this is more specific to the Search API solr module issue queue?
- last update
10 months ago Composer require-dev failure - last update
10 months ago Composer require-dev failure - 🇳🇿New Zealand ericgsmith
Changed the cache plugin from
none
tosearch_api_none
in the none display used in theViewsDisplayCachingTest
test - passes locally but CI seems to have unrelated issue.We probably then want an update hook to convert displays from none to search_api_none? Will wait for maintainer feedback before doing any more here.
For context, we picked this up as an change in metatag module means the meta tags are now a computed field so the meta tag values are generated when the node is serialized, on a display with many search record rows enabled that was enough to notice a performance regression.
- Status changed to Needs review
10 months ago 10:21pm 22 February 2024 - 🇦🇹Austria drunken monkey Vienna, Austria
drunken monkey → made their first commit to this issue’s fork.
- 🇦🇹Austria drunken monkey Vienna, Austria
Thanks for reporting this issue! Pretty bad if a cache plugin that is supposed to do nothing actively hurts performance. Your solution seems sensible, so thanks for that! I made a few updates, including an update hook and generally the same treatment for this new cache plugin as we introduced for the existing ones back in #2809469: Set search api caching as default for new search api views → . Please test/review!
Disabling Views caching is definitely a relevant use case for other backends, too. In general, it can be tricky to achieve a reasonable cache hit ratio for searches. Plus, other backends have an indexing delay as well, leading to the same problem with caching as when using Solr.
- 🇦🇹Austria drunken monkey Vienna, Austria
Oh, and you’ll be glad to hear that MR testing should now work correctly in this module, so I expect the tests to pass now.
- 🇳🇿New Zealand ericgsmith
Thank you Thomas!
Tested the additional changes and it looks good - the update hook ran as expected and converted my views 👍
Only noticed one side effect from the change / fix from https://git.drupalcode.org/project/search_api/-/merge_requests/109/diffs...
Previously when creating a new view the default cache value is
tag
coming from views - and was being changed tonone
by that line above. Now this is changed tosearch_api_tag
- which seems to be a sensible thing to expect - but is a change in behavior so just noting that.But this also is why the
ViewsQueryTypeTest
test is failing - it uses config that uses the cache typetag
and expects it to be saved asnone
. I assume the test should expectsearch_api_tag
- just wanted to double check if there was any reason the conversion logic was previously to set tonone
. - 🇦🇹Austria drunken monkey Vienna, Austria
Thanks for pointing this out!
The change by me was indeed on purpose, but now that I think about it again I’m not sure anymore. It seems logical, of course, to “auto-correct”, e.g., the incompatible tag-based cache plugin to the compatible one.
On the other hand, defaulting to “None” previously was of course also on purpose, since this is still the “safest” plugin for Search API views, where the intricacies of searching with an external server can often mess up proper caching. So, if someone manages to select an incompatible plugin (which shouldn’t even be possible, really, in the UI), it seems safer to just set the view to have no caching so the user explicitly needs to select the correct option and maybe is motivated to look a bit closer into caching of searches.Hard to decide, but in the end it seems much safer to keep the behavior we had before (for over seven years, it seems?) and only think about adapting it in a new issue, if it bothers enough people and we can reach a clear vote on changing the behavior.
I adapted the code accordingly.Would you say this is ready to be merged now?
- 🇳🇿New Zealand ericgsmith
Thanks, that makes sense and I agree with you that keeping the existing behavior is safest.
And yes - this looks good to merge to me, Thank you!
-
drunken monkey →
committed d4f81708 on 8.x-1.x authored by
ericgsmith →
Issue #3423063 by ericgsmith, drunken monkey: Fixed performance issue in...
-
drunken monkey →
committed d4f81708 on 8.x-1.x authored by
ericgsmith →
- Status changed to Fixed
10 months ago 12:44pm 10 March 2024 - 🇦🇹Austria drunken monkey Vienna, Austria
Good to hear, thanks for reporting back.
Merged.
Thanks again! Automatically closed - issue fixed for 2 weeks with no activity.
- 🇦🇺Australia acbramley
The post update hook committed here is bugged, see 🐛 search_api_post_update_views_cache_none() replaces all cache types with "search_api_none" RTBC - this should probably be resolved asap with a new minor.