dotCMS / dotCMS/core

[FEATURE] Include Date/Time fields in guessWhatFieldsToIndex for dotAI content indexing

Open
#33,578 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Problem

Currently, the ContentToStringUtil.impl.get().guessWhatFieldsToIndex(contentlet) method only includes fields of type DataTypes.LONG_TEXT when determining which fields to send to dotAI for indexing.

As a result, Date/Time fields that are indexed within a content type are not being automatically included when dotAI builds its index. This causes AI queries related to event dates (e.g., “When is the next event?”) to fail, even though those fields exist and are indexed in dotCMS.

Goal

The guessWhatFieldsToIndex method should automatically include Date/Time fields (and potentially other scalar types like integers and floats) when the content type specifies them as indexed.

dotAI should index these fields without requiring manual configuration or explicit listing in the dotai.json file.

currently

Only text-based fields (LONG_TEXT) are included automatically.
Date/Time fields are ignored unless explicitly added in configuration

dotAI should support an optional Velocity template definition per content type, allowing developers to control exactly how and what content is sent for AI indexing.

Target Personas
  • Developer teams
  • Content teams
  • DevOps teams
  • System administrators (dotCMS)
Demo Expectations

Enhance guessWhatFieldsToIndex to:

Include DataTypes.DATE and DataTypes.DATE_TIME fields when marked as indexed.

Optionally include other field types (e.g., integer, boolean) for future extensibility.

Example:

if (field.isIndexed() &&
(field.getFieldType() == DataTypes.LONG_TEXT
|| field.getFieldType() == DataTypes.DATE
|| field.getFieldType() == DataTypes.DATE_TIME)) {
fieldsToIndex.add(field);
}

  1. Introduce Velocity-based Indexing Template

Allow specifying an optional Velocity (VTL) file in configuration to override how a given content type is indexed:
The Velocity template would define how to structure and render the content for dotAI.

Fallback to the default behavior if no template is provided.

Acceptance Criteria

No response

User Stories

No response

Links

https://dotcms.freshdesk.com/a/tickets/33478
https://dotcms.slack.com/archives/C08F8NZRK9S/p1760108525826669

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ContentToStringUtil.impl.get().guessWhatFieldsToIndex(contentlet) and trace how indexed fields are selected for dotAI. Review the dotai.json configuration path and determine the scope of optional Velocity templates; done should include coverage for DATE and DATE_TIME fields plus fallback behavior when no template is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ai, backend, search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.