Allow record manipulation before writing

Created on 1 April 2022, over 2 years ago
Updated 14 May 2024, 6 months ago

Problem/Motivation

I'm developing a site using "Domain Access" and I thought of tracking down the domain for which the keywords are searched, to be able to split . I altered the search_api_stats table to include a domain_id column and I was looking forward to alter the query that inserts the record. It turns out that insert queries do not invoke any hook for manipulating the query before execution. So in the end I need to manipulate those data in a different way.
I'd suggest to create a hook to allow the record manipulation before the actual insert takes place.

Steps to reproduce

  • Create a custom module and implement a hook_query_alter that logs the query so we can check later
  • Execute a search operation and verify that the record for the new search has been inserted
  • Verify that no insert query has been logged by the custom hook

Proposed resolution

Implement a hook to alter the record before actually inserting it.

Remaining tasks

  1. Approve approach.
  2. Create the patch.
  3. Create the fork.
  4. Create the MR.

User interface changes

No

API changes

We will improve the APIs by adding a hook implementation to manipulate the written record before the actual query execution.

Data model changes

No

Feature request
Status

Fixed

Version

1.0

Component

Code

Live updates comments and jobs are added and updated live.
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.

Production build 0.71.5 2024