bug: doc_language return null when document segment settings #5253

Closed
opened 2026-02-21 18:10:05 -05:00 by yindo · 1 comment
Owner

Originally created by @JiakunXu on GitHub (Aug 27, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.7.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

doc_language return null when document segment settings

image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @JiakunXu on GitHub (Aug 27, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.7.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce doc_language return null when document segment settings <img width="638" alt="image" src="https://github.com/user-attachments/assets/76e05dac-e9f6-46a6-a634-6015cdf3791f"> ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:10:05 -05:00
yindo closed this issue 2026-02-21 18:10:06 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 27, 2024):

The doc_language field in the Document model is nullable, which means it can return null if not explicitly set during document processing. When document segment settings are enabled, the doc_language field might not be set during the parsing, cleaning, splitting, and indexing stages, leading to it being null.

To ensure the doc_language is set, you need to add logic to determine and set the document language during one of the processing stages, such as during parsing if the language can be detected from the document content [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 27, 2024): <!-- Answer --> The `doc_language` field in the `Document` model is nullable, which means it can return `null` if not explicitly set during document processing. When document segment settings are enabled, the `doc_language` field might not be set during the parsing, cleaning, splitting, and indexing stages, leading to it being `null`. To ensure the `doc_language` is set, you need to add logic to determine and set the document language during one of the processing stages, such as during parsing if the language can be detected from the document content <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/models/dataset.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5253