Closed (duplicate)
Project:
Search API
Version:
8.x-1.x-dev
Component:
Framework
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
1 Apr 2015 at 12:21 UTC
Updated:
11 Feb 2016 at 19:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
berdirThere is one interesting challenge compared to core. For example with search api solr, indexing will be a bit delayed, if we immediately invalidate the cache tag after indexing new things, then a request might not actually see it yet...
Comment #2
drunken monkeyThanks for creating this issue, really important we properly support this!
You're right about Solr. Seems like we'll need a way for the backend to override the cache information that will be set on search results? (E.g., use
max-ageinstead, or even disable caching for Solr results.)At least I can't think of a way to properly handle this. Even if an automatic soft commit occurs within a second, we could still be caching the old results after the cache tag was invalidated – we'd somehow need to set a timeout on when to invalidate the cache tag, and I don't see any reasonable way to do that.
Also, I think other plugins don't need a way to override caching information – do they? In theory, a processor could influence the cacheability of content (by using query-independent data for computations in
postprocessSearchResults()) – should we support that, or can we ignore it?But I guess, for either use case, it's always possible for other modules to alter the render array and, thus, the cache information. So with that, we don't need to support all use cases. But proper caching (and cache invalidation) for database searches should definitely be supported by default.
Comment #3
borisson_Comment #4
borisson_So I looked at this and for some reason the newly added cache tag doesn't bubble up.
Comment #5
borisson_This should implement clearing caches on search api index.
Comment #6
drunken monkeyThanks, looks like a good start!
But shouldn't the cache tag have some kind of
search_apiprefix?Also, I think we shouldn't invalidate the tag right when creating the item, but at the end of the method just invalidate all the IDs in
$processed_ids– that way:Also, this is only a small part of our caching strategy, I think. We want to support caching in the following ways (as far as I understand):
I think we'd need Views to discern between those two cases – which isn't really trivial. Currently, I think only the former is supported anyways (since we only have the "Rendered item" row plugin), so we could go for that – but later, Solr might even store a cached version of the entity and return that with the results, and then it would even be hard to determine where the entity comes from (same for displayed fields, though).
I'm just repeating what I heard from others here, though. Is there actually caching for this already? (I.e., for a Views result, no matter what row or style plugin it uses?)
Comment #7
drunken monkeyBy the way, here is documentation about the D8 caching system.
Comment #8
wim leersActually, you linked to the render caching documentation. Which of course is very closely related. The caching system itself is documented at https://www.drupal.org/developing/api/8/cache.
Comment #9
berdirThis is about render caching, just has an issue title that's not very specific :)
Comment #10
wim leersExcellent then :)
Comment #11
borisson_I think we can close this because of #2624472: Make sure that cache tags of index and server are added to search result pages.