~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(evernote): keep every tag of a note and separate notes in a single document (#7730)
Lukasa4d871669060
diff --git a/changelog.d/7730.bugfix.md b/changelog.d/7730.bugfix.mdnew file mode 100644index 0000000000..036fa2ca54--- /dev/null+++ b/changelog.d/7730.bugfix.md@@ -0,0 +1,3 @@+Evernote imports keep every tag of a note: each `<tag>` element overwrote the one before,+so only the last tag survived. With `load_single_document=True`, notes are separated by a+blank line instead of running into each other.diff --git a/src/local_deep_research/document_loaders/evernote_loader.py b/src/local_deep_research/document_loaders/evernote_loader.pyindex e7554a0a2e..06ace9d4db 100644--- a/src/local_deep_research/document_loaders/evernote_loader.py+++ b/src/local_deep_research/document_loaders/evernote_loader.py@@ -54,7 +54,9 @@ class EverNoteLoader(BaseLoader):notes = self._iter_notes()if self.load_single_document:yield Document(- page_content="".join(note.page_content for note in notes),+ # A blank line between notes, so one note's last word does not run into+ # the next note's first+ page_content="\n\n".join(note.page_content for note in notes),metadata={"source": self.file_path},)else:@@ -90,6 +92,12 @@ class EverNoteLoader(BaseLoader):metadata[f"note-attributes.{attribute.tag}"] = (attribute.text)+ elif child.tag == "tag":+ # A note has one <tag> element per tag+ if child.text:+ metadata.setdefault("tag", []).append(+ child.text+ )elif child.tag in {"created", "updated"}:metadata[child.tag] = (strptime(child.text, "%Y%m%dT%H%M%SZ")diff --git a/tests/document_loaders/test_evernote_extraction.py b/tests/document_loaders/test_evernote_extraction.pyindex e02f83152e..ee7b2dc22a 100644--- a/tests/document_loaders/test_evernote_extraction.py+++ b/tests/document_loaders/test_evernote_extraction.py@@ -150,3 +150,32 @@ def test_evernote_keeps_note_attributes_without_script_text():assert documents[0].metadata["note-attributes.source-url"] == ("https://example.org/item")+++def test_evernote_keeps_every_tag_of_a_note():+ export = """<?xml version="1.0" encoding="UTF-8"?>+<en-export><note><title>Tagged</title><tag>work</tag><tag>urgent</tag>+<content><![CDATA[<en-note><div>Body</div></en-note>]]></content></note>+<note><title>Untagged</title>+<content><![CDATA[<en-note><div>Other</div></en-note>]]></content></note></en-export>"""+ documents = load_from_bytes(export.encode(), ".enex", "tags.enex")+ assert documents[0].metadata["tag"] == ["work", "urgent"]+ assert "tag" not in documents[1].metadata+++def test_evernote_single_document_separates_its_notes(tmp_path):+ from local_deep_research.document_loaders.evernote_loader import (+ EverNoteLoader,+ )++ path = tmp_path / "notes.enex"+ path.write_text(+ """<?xml version="1.0" encoding="UTF-8"?>+<en-export><note><title>First</title>+<content><![CDATA[<en-note><div>Ends here</div></en-note>]]></content></note>+<note><title>Second</title>+<content><![CDATA[<en-note><div>Starts here</div></en-note>]]></content></note></en-export>""",+ encoding="utf-8",+ )+ [document] = EverNoteLoader(path).lazy_load()+ assert document.page_content == "Ends here\n\nStarts here"