- First commit to issue fork.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 8.1 & sqlite-3.27last update
over 1 year ago Not currently mergeable. - last update
over 1 year ago Composer require-dev failure - last update
over 1 year ago Patch Failed to Apply - last update
over 1 year ago Patch Failed to Apply - last update
over 1 year ago 544 pass - last update
over 1 year ago 543 pass - 🇺🇸United States bkosborne New Jersey, USA
The proposed page reverts the change introduced 4 years ago in #3026526: SearchApiTagCache::getRowId is very expensive → which was done for performance reasons. So I don't think this patch would be committed as-is. It sounds like the row ID may need to more complicated than just providing the Search API ID, but less complicated than the default views implementation.
- last update
about 1 year ago 545 pass - 🇦🇹Austria drunken monkey Vienna, Austria
Thanks a lot for reporting this problem, and sorry it took me so long to reply.
It indeed seems like the solution in #3026526: SearchApiTagCache::getRowId is very expensive → was a bit too simple. (It kind of seems like we didn’t understand the difference between cache keys and cache tags?) Maybe we should just go with something like the initially suggested fix?
Patch attached, please test/review!This will also need a regression test before it can be committed. Would anyone here be able to provide one?
- 🇳🇱Netherlands markwittens
Isn't it possibible to fix this problem by highlighting the match using javascript instead of messing with the cache?
- 🇨🇦Canada ambient.impact Toronto
@markwittens Yes, you could, but just because you can do something in client-side JavaScript doesn't mean it's always the best or most appropriate tool for the job. It feels more robust and a better long term approach to me to figure out the server-side caching, which not only fixes this issue but also acts as a reference for future features in this and other projects that require caching. Modern Drupal's cache API is purpose built for this very problem and hella fast when implemented correctly. And no, I don't hate JavaScript; I actually write a implement a lot of it; see 📌 Hotwire Turbo minimum viable implementation Active 😉
- 🇨🇴Colombia opregonerog
Hi guys, im facing the same issue in a site that use solr, the hightlights get cached and dont hightlight the corrects words, its posible that the issue is because im using solr¿?
- 🇫🇷France dco
Patch in #12 is not solving the issue for me too
Excerpt stil not visible for anonymous users - 🇩🇪Germany a.dmitriiev
search_api_excerpt
extra field has cache contexturl.query_args
. I assume it is not taken into account when Search API Cache plugin for views is in place. The plugin collects object cache tags withgetRowCacheTags
method, but cache context is not taken into account. Maybe there is need to implement `alterCacheMetadata` method and add the cache context? But in this case the plugin needs some how to collect this cacheable metadata from the rendered entities that havesearch_api_excerpt
extra field for this view. - 🇦🇹Austria drunken monkey Vienna, Austria
Would someone be willing/able to write a failing test for this? That would make it much easier to find the correct solution, I think.
- 🇺🇸United States vlyalko
Patch in #12 is not solving the issue for me either
And also confirm that Excerpt is not visible for anonymous users (using search_api_solr)
Using solr views and Search result excerpt in the Content type displayDrupal 10.3.1
Search_api 8.x-1.35
Search_api_solr 4.3.5 - 🇺🇸United States vlyalko
Update, wanted to confirm that combination of the patch #12 from this issue: 3284807-12--fix_tag_based_caching_highlighted_fields.patch and https://www.drupal.org/files/issues/2024-08-21/3209441-23--cache_metadat... → fixed all the issues for me:
Excerpt is visible for anon user
Search highlighting is working as expected.Again, my setup:
Drupal 10.3.1
Search_api 8.x-1.35
Search_api_solr 4.3.5 - 🇫🇷France dco
Hi,
Following @vlyalko post, I applyed the two patches (#12 and #23) and it works now
https://www.drupal.org/files/issues/2023-10-29/3284807-12--fix_tag_based... →
and
https://www.drupal.org/files/issues/2024-08-21/3209441-23--cache_metadat... →
fixed all the issues for me too, excerpt are now visibles for anonymous users
- 🇩🇪Germany a.dmitriiev
The same combination of patches helps in my case as well.
- 🇦🇹Austria drunken monkey Vienna, Austria
Postponing this to work in 🐛 Excerpt fields are not rendered for anonymous users Needs work instead, please follow that issue, too, if you are still interested. Seems the two problems are too closely related to fix either one on its own. This issue might just be closed. (I’ve added issue credits in the other issue already.)