Problem / Motivation
Currently, AI Content Chat only supports indexing node content types. Many Drupal sites store important content across multiple entity types beyond nodes:
- Taxonomy terms – vocabularies with descriptions (e.g., glossaries, FAQs, product categories)
- Block content (custom blocks) – reusable content blocks with important information (e.g., "About us", contact details, policies)
- Media – media entities with descriptive metadata
- Commerce products – product descriptions for e-commerce sites
- Any custom entity type – contributed or custom modules that define their own content entities
By only supporting nodes, the chatbot misses a significant portion of the site's content, leading to incomplete or inaccurate answers.
Proposed resolution
Make the indexer fully entity-type agnostic:
- Settings form: Replace the hardcoded node bundle list with a dynamic list of all available content entity types and their bundles. The admin selects which entity types, bundles, and fields to index.
- ContentIndexer service: Replace all node-specific code (
NodeInterface,getStorage('node'),getTitle()) with generic entity handling usingContentEntityInterface,EntityInterface::label(), and dynamic bundle key lookups. - Entity hooks: Update
hook_entity_insert,hook_entity_update, andhook_entity_deleteto react to any configured content entity type, not just nodes. - Config schema: Extend
content_sourcesto include anentity_typekey alongsidebundleandfields. - Database: No schema changes needed – the
entity_typecolumn already exists in the index table. - Backward compatibility: An update hook migrates existing
content_typeconfig entries to the newentity_type+bundleformat automatically.
Acceptance criteria
- Admin can select any content entity type (node, taxonomy_term, block_content, media, etc.) on the settings form
- Text fields for each bundle are dynamically discovered
- Indexing, re-indexing, and automatic index updates work for all configured entity types
- The chatbot uses content from all indexed entity types when answering questions
- Existing node-only configurations continue to work after running
drush updb - Internal/non-useful entity types (user, file, path_alias, etc.) are filtered from the settings form
Issue fork ai_content_chat-3573440
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
Comment #4
solimanharkas commented