Add tests for caching on user-added Search page

Created on 3 April 2015, about 10 years ago
Updated 8 May 2025, 2 days ago

On #2460911: Search reindexing should invalidate cache tags β†’ and #2241249: First step in making search results pages cacheable: add the associated SearchPage's cache tag β†’ , we added cache tags to Search pages, along with some tests.

The tests just use the default provided NodeSearch and UserSearch configuration. That is a good test, and the functionality is correct, but it's a bit of a special case in that the machine name of the config entities for both of these default configs match the plugin type ID (node_search and user_search, respectively), so to be really future proof against someone trying to optimize the code or something, the test should really verify that the correct cache tags are added also with a user-created search page.

How to verify this in the UI:

a) Go to admin/config/search/pages
b) Add new pages of types Content and User. You'll be providing a label, machine name, and URL suffix for each.
c) Search using these new pages (at path search/[suffix]).
d) Verify the correct cache tags are in the response header:
- For content search: search_index, search_index:node_search, and the config item's full ID
- for user search: the config item's full ID

If #2464409: Search results should bubble rendered entity cache tags and set list cache tags β†’ is finished, there will be additional tags in (d): node_list, individual node IDs, user_list probably

For reference on how to do this in a test (creating the search pages), let's see, we're doing this in
SearchConfigSettingsFormTest::testMultipleSearchPages
although that uses the "extra type" rather than NodeSearch or UserSearch. But it may help.

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

search.module

Created by

πŸ‡ΊπŸ‡ΈUnited States jhodgdon Spokane, WA, USA

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024