fix full-doc mode document doesn't reindex after enable or un_archive (#16737)

This commit is contained in:
Jyong
2025-03-25 16:26:14 +08:00
committed by GitHub
parent 2174225259
commit 58c62f0a34
6 changed files with 22 additions and 5 deletions

View File

@@ -720,6 +720,23 @@ class DocumentSegment(db.Model): # type: ignore[name-defined]
else:
return []
def get_child_chunks(self):
process_rule = self.document.dataset_process_rule
if process_rule.mode == "hierarchical":
rules = Rule(**process_rule.rules_dict)
if rules.parent_mode:
child_chunks = (
db.session.query(ChildChunk)
.filter(ChildChunk.segment_id == self.id)
.order_by(ChildChunk.position.asc())
.all()
)
return child_chunks or []
else:
return []
else:
return []
@property
def sign_content(self):
return self.get_sign_content()