Problem/Motivation

Currently, the module triggers a re-computation of vector embeddings whenever the index configuration is saved or updated, even if the changes do not affect the content being embedded. This behavior is inefficient and costly because:

  • Generating embeddings (e.g., via external APIs like OpenAI) often incurs financial costs per token.
  • The process is computationally expensive and slows down the indexing operation.
  • It is unnecessary to regenerate embeddings if the source fields (e.g., title, body) and the embedding configuration (e.g., model selection) have not changed.

Steps to reproduce

  1. Configure a Search API index using the Typesense backend with embeddings enabled on specific fields (e.g., body).
  2. Index the content to generate the initial embeddings.
  3. Go to the index schema configuration page and change a setting unrelated to embeddings (e.g., change the "Batch size" or disable a different, unrelated processor).
  4. Save the configuration.
  5. Observe that the system marks the items for re-indexing and subsequently re-computes the embeddings, leading to unnecessary API calls.

Proposed resolution

Modify the logic to detect whether the configuration changes actually impact the embedding generation. The system should only trigger a re-computation of embeddings if:

  • The fields selected for embedding have been modified.
  • The embedding configuration itself (e.g., the chosen model or strategy) has changed.

If the configuration change is irrelevant to the embeddings (e.g., changing a different processor), the existing embeddings should be preserved to save resources.

Remaining tasks

  • Review the code changes in the merge request.
  • Test to ensure that changing unrelated index configuration does not trigger embedding re-computation.
  • Test to verify that changing the embedding settings does trigger a re-computation as expected.

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

giuseppe87 created an issue. See original summary.

giuseppe87’s picture

Status: Active » Needs review

lussoluca made their first commit to this issue’s fork.

robertoperuzzo’s picture

Assigned: giuseppe87 » robertoperuzzo
robertoperuzzo’s picture

Issue summary: View changes
robertoperuzzo’s picture

Issue summary: View changes
Issue tags: +GlobalContributionWeekend2026
robertoperuzzo’s picture

Thanks @lussoluca and @giuseppe87 for what you've done so far!
I sum up here what I did in my latest commits:

  1. Removed DDEV development configuration - Deleted all .ddev folder files (development environment setup, Docker configs, and various testing commands)
  2. Added new features - Created two new test files with over 500 lines of test coverage for the embedder and schema functionality
  3. Enhanced existing code - Updated the schema entity, form handling, and embedder classes with improvements and bug fixes
  4. Updated documentation - Expanded the README with more information

If someone can review that, I'd appreciate it.

robertoperuzzo’s picture

Assigned: robertoperuzzo » Unassigned

lussoluca’s picture

Status: Needs review » Fixed

Committed to 1.2.0-beta1. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.