Commit 7e661ca9 authored by Thomas Seiber's avatar Thomas Seiber
Browse files

Issue #3247840 by drunken monkey: Added a hidden datasource option to disable...

Issue #3247840 by drunken monkey: Added a hidden datasource option to disable the direct SQL query "fast path" for initial entity tracking.
parent 4da2f384
Loading
Loading
Loading
Loading
+2 −0
Changes for CHANGELOG.txt: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
Search API 1.x, dev (xxxx-xx-xx):
---------------------------------
- #3247840 by drunken monkey: Added a hidden datasource option to disable the
  direct SQL query "fast path" for initial entity tracking.

Search API 1.25 (2022-07-18):
-----------------------------
+3 −0
Changes for config/schema/search_api.datasource.schema.yml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@
          sequence:
            type: string
            label: 'A bundle machine name'
    disable_db_tracking:
      type: boolean
      label: 'Do not use a database query for tracking'
    languages:
      type: mapping
      label: 'Languages'
+6 −2
Changes for src/Plugin/search_api/datasource/ContentEntity.php: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -649,7 +649,10 @@ class ContentEntity extends DatasourcePluginBase implements PluginFormInterface
      }
    }

    $this->setConfiguration($form_state->getValues());
    // Make sure not to overwrite any options not included in the form (like
    // "disable_db_tracking") by adding any existing configuration back to the
    // new values.
    $this->setConfiguration($form_state->getValues() + $this->configuration);
  }

  /**
@@ -790,7 +793,8 @@ class ContentEntity extends DatasourcePluginBase implements PluginFormInterface
    // on large data sets. This allows for better control over what tables are
    // included in the query.
    // If no base table is present, then perform an entity query instead.
    if ($entity_type->getBaseTable()) {
    if ($entity_type->getBaseTable()
        && empty($this->configuration['disable_db_tracking'])) {
      $select = $this->getDatabaseConnection()
        ->select($entity_type->getBaseTable(), 'base_table')
        ->fields('base_table', [$entity_id]);