dotAI Auto Update Index is not creating/updating indexes
Parent Issue
No response
Problem Statement
When setting up auto-indexation according to the instructions in the UI, and then publlishing content of those types, the index is not created, nor updated
https://github.com/user-attachments/assets/caaffad0-3c4a-4823-9c0a-d949e1413451
Steps to Reproduce
I added a working API key and also tested creating dotAI indexes manually (which worked fine) Then I went to the dotAI config for demo.dotcms.com on the LTS server I was testing and added the following "Auth Index Content Config" { "default": "webPageContent", "activity": "Activity" } Then I saved and published both webpage content and Activities... however, no indexes were created or updated. I tested this several times... no errors in the log, and when testing with a developer we saw only one of the logs update for one piece of content, then deleted that index and could not get it to generate again by following the same steps. So, when testing, if you get an index, delete that index and try to add a new piece of content and verify the index again. Repeated attempts will generate the bug even if the first one does not.
Acceptance Criteria
With the following config: { "default": "webPageContent", "activity": "Activity" }
Publishing webpage content (Rich Text) or creating/updating an Activity should cause the indexation of the content and the index should be visible under the dotAI "Manage Embeddings/Indexes" tab
dotCMS Version
Tested on: 24.04.24ltsv15 - support QA server 24.10.25
Proposed Objective
Customer Support
Proposed Priority
Priority 2 - Important
External Links... Slack Conversations, Support Tickets, Figma Designs, etc.
https://helpdesk.dotcms.com/a/tickets/30067
Assumptions & Initiation Needs
No response
Quality Assurance Notes & Workarounds
No response
Sub-Tasks & Estimates
No response
I just tested on demo.dotcms.com and the same sporadic behavior is there too (especially with new content added instead of updating existing content):
https://github.com/user-attachments/assets/6e54b06a-650d-4a4a-9764-a73c1f361b2f
https://github.com/dotCMS/core/issues/31594
Failed QA: Issue still happening. Getting this message in the logs:
dotcms-1 | 14:51:12.006 WARN api.EmbeddingsAPIImpl - No valid fields to embed for Contentlet ID 'c683669dca86836905f22e84cd690e3a' of type 'Activity' with title 'hola'
It worked for mw but I changed the config from
{
"default": "webPageContent",
"activity": "Activity"
}
TO:
{
"default": "webPageContent",
"activity": "Activity.title,Activity.urlTitle,Activity.description"
}
Based on the code, it seems the config is expecting not just the Content Type name, but specific fields. That’s why I updated the config. Also, when these values are concatenated, they need to be longer than 64 characters to be valid — so make sure to fill in the description field for it to work.
I don't know if this behavior is ok or maybe this is not right
This is not quite true - you can pass fields for sure but if you don't pass fields, it tries to guess which field to index based on content type and field type.
https://github.com/dotCMS/core/blob/main/dotCMS/src/main/java/com/dotcms/ai/util/ContentToStringUtil.java#L163
This is not quite true - you can pass fields for sure but if you don't pass fields, it tries to guess which field to index based on content type and field type.
https://github.com/dotCMS/core/blob/main/dotCMS/src/main/java/com/dotcms/ai/util/ContentToStringUtil.java#L163
Yes, in that case the fields are description and body for Activity, but the values concat of this fields must be longer than 64 characters to be valid (by default), in the example in the card is less than that
This is not actually a bug. Instead, we will improve both the log and UI error messages as follows:
When creating the index:
- Improve error log messages for individual contentlet failures:
For missing required fields. For field values that exceed the 64-character limit.
When publishing a contentlet:
- Send a notification if the contentlet fails to be included in the AI index.
When the dotAI App is update
- Check if the key is ok, if not then send a notification
PRs:
- https://github.com/dotCMS/core/pull/32546
- https://github.com/dotCMS/core/pull/32571
Failed QA.
Getting this error even when using the right configuration and trying to index a newly published Activity
dotcms-1 | 14:30:22.169 INFO listener.EmbeddingContentListener - GOT onPublish - PublishEvent:true for content: hola 5 id:97a21ee706060fd6e0b63c9daedf9286
dotcms-1 | 14:30:22.170 INFO util.ContentToStringUtil - Activity.title is a text field
dotcms-1 | 14:30:22.170 INFO util.ContentToStringUtil - Activity.urlTitle is a Custom Field
dotcms-1 | 14:30:22.170 INFO util.ContentToStringUtil - Activity.description is a text field
dotcms-1 | 14:30:22.171 WARN api.EmbeddingsAPIImpl - Something is wrong with the content, and the Contentlet cannot be embedded:
dotcms-1 | Found fields from configuration:java.util.stream.ReferencePipeline$3@27ab6f00
and the Contentlet cannot be embedded:
It looks like the issue is that you're not setting the description and body fields properly. Both of these fields must contain at least 64 characters for the content to be processed correctly.
Also, in the dotAI App, you can enable debug logging for dotAI operations by setting the variable com.dotcms.ai.debug.logging to true. Note that this setting is part of the dotAI App configuration, not the main config.properties file.
Once enabled, you'll get more detailed error messages in the logs. For example:
15:54:06.890 INFO util.ContentToStringUtil - Parseable fields for Contentlet ID 'c20a9bb073e0c71f72ae8d321f882013' don't meet the minimum length requirement of 64 characters. Skipping indexing.
15:54:06.890 WARN api.EmbeddingsAPIImpl - Something is wrong with the content, and the Contentlet cannot be embedded:
QA: PASSED ✅
- Docker image:
trunk_40acf5b
As @freddyDOTCMS mentioned in his comment the total sum of characters in the indexable fields must be at least 64 for the Contentlet to be added to the embeddings.
For instance, if you try to publish a Contentlet of type Activity that does NOT meet such a requirement, the following messages will be logged:
21:15:57.632 INFO listener.EmbeddingContentListener - GOT onPublish - PublishEvent:true for content: hello2 id:12d42fa1f25dac191ab38c4c0d84a63e
21:15:57.637 INFO util.ContentToStringUtil - Found 2 indexable field(s) for Contentlet ID '12d42fa1f25dac191ab38c4c0d84a63e': [description, body]
21:15:57.637 INFO util.ContentToStringUtil - Activity.body is an HTML field
dotcms-1 | 21:22:43.149 WARN api.EmbeddingsAPIImpl - Something is wrong with the content, and the Contentlet cannot be embedded:
dotcms-1 | Found fields from guessing:java.util.stream.ReferencePipeline$3@7c4a2325
If you enable to debug logging by setting the com.dotcms.ai.debug.logging property to true in the dotAIApp, you'll get an additional error message indicating the minimum amount of characters that must be present in a Contentlet for it to be added to the embeddings:
21:15:57.632 INFO listener.EmbeddingContentListener - GOT onPublish - PublishEvent:true for content: hello2 id:12d42fa1f25dac191ab38c4c0d84a63e
21:15:57.637 INFO util.ContentToStringUtil - Found 2 indexable field(s) for Contentlet ID '12d42fa1f25dac191ab38c4c0d84a63e': [description, body]
21:15:57.637 INFO util.ContentToStringUtil - Activity.body is an HTML field
21:15:57.641 INFO util.ContentToStringUtil - Parseable fields for Contentlet ID '12d42fa1f25dac191ab38c4c0d84a63e' don't meet the minimum length requirement of 64 characters. Skipping indexing.
21:15:57.641 WARN api.EmbeddingsAPIImpl - Something is wrong with the content, and the Contentlet cannot be embedded:
Found fields from guessing:java.util.stream.ReferencePipeline$3@7f8c5c01
Future Improvements:
The current error message:
dotcms-1 | 21:22:43.149 WARN api.EmbeddingsAPIImpl - Something is wrong with the content, and the Contentlet cannot be embedded:
dotcms-1 | Found fields from guessing:java.util.stream.ReferencePipeline$3@7c4a2325
Might include some improvements:
- There's actually nothing "wrong" with the Contentlet per se. It just doesn't meet the required criterion for it to be embedded.
- The
Found fields from guessingmessage is not listing the Velocity Var Names correctly. There seems to be something missing in the lambda.