Fix: handle notes without a user when building the search index (#13260)

This commit is contained in:
Matthias Mast
2026-07-24 06:39:11 -07:00
committed by GitHub
parent 6d249b4932
commit b992f9fc05
2 changed files with 24 additions and 1 deletions
+7 -1
View File
@@ -475,7 +475,13 @@ class TantivyBackend:
note_texts: list[str] = []
for note in document.notes.all():
num_notes += 1
doc.add_json("notes", {"note": note.note, "user": note.user.username})
doc.add_json(
"notes",
{
"note": note.note,
"user": note.user.username if note.user else None,
},
)
note_texts.append(note.note)
if note_texts:
doc.add_text("notes_text", " ".join(note_texts))