From fdf99b2bb02c9148c76a9b5058657b6ead442f09 Mon Sep 17 00:00:00 2001 From: Lars Date: Sun, 28 Dec 2025 18:53:11 +0100 Subject: [PATCH] bug fix --- app/frontend/ui_graph_service.py | 44 ++++++-------------------------- 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/app/frontend/ui_graph_service.py b/app/frontend/ui_graph_service.py index 0ca5c51..fc2d3e2 100644 --- a/app/frontend/ui_graph_service.py +++ b/app/frontend/ui_graph_service.py @@ -133,7 +133,6 @@ class GraphExplorerService: return "\n\n".join(full_text) except: return "Fehler beim Laden des Volltexts." - def _fetch_previews_for_nodes(self, node_ids): """ Holt Batch-weise den ersten relevanten Textabschnitt für eine Liste von Nodes. @@ -193,20 +192,13 @@ class GraphExplorerService: titles_to_check = [] if note_title: titles_to_check.append(note_title) - - # Aliase laden für robuste Verlinkung (auch wenn note_title fehlt) - for nid in note_ids: - note = self._fetch_note_cached(nid) - if note: - # Füge Titel hinzu, falls noch nicht vorhanden - note_title_from_db = note.get("title") - if note_title_from_db and note_title_from_db not in titles_to_check: - titles_to_check.append(note_title_from_db) - # Aliase hinzufügen - aliases = note.get("aliases", []) - if isinstance(aliases, str): - aliases = [aliases] - titles_to_check.extend([a for a in aliases if a and a not in titles_to_check]) + # Aliase laden für robuste Verlinkung + for nid in note_ids: + note = self._fetch_note_cached(nid) + if note: + aliases = note.get("aliases", []) + if isinstance(aliases, str): aliases = [aliases] + titles_to_check.extend([a for a in aliases if a not in titles_to_check]) # Exakte Titel-Matches hinzufügen for t in titles_to_check: @@ -339,9 +331,8 @@ class GraphExplorerService: self._ref_resolution_cache[ref_str] = note return note - # 2. Versuch: Titel-Suche (erst exakt, dann Text-Suche für Fuzzy-Matching) + # 2. Versuch: Titel-Suche (Keyword-Match) try: - # 2a: Exakte Übereinstimmung res, _ = self.client.scroll( collection_name=self.notes_col, scroll_filter=models.Filter(must=[ @@ -353,25 +344,6 @@ class GraphExplorerService: payload = res[0].payload self._ref_resolution_cache[ref_str] = payload return payload - - # 2b: Text-Suche für Fuzzy-Matching (falls exakt fehlschlägt) - res, _ = self.client.scroll( - collection_name=self.notes_col, - scroll_filter=models.Filter(must=[ - models.FieldCondition(key="title", match=models.MatchText(text=base_ref)) - ]), - limit=10, with_payload=True - ) - if res: - # Prüfe alle Ergebnisse und nimm das beste Match - for r in res: - if r.payload: - note_title = r.payload.get("title", "") - # Exakte Übereinstimmung oder beginnt mit base_ref - if note_title == base_ref or note_title.startswith(base_ref): - payload = r.payload - self._ref_resolution_cache[ref_str] = payload - return payload except Exception: pass