bug fix
This commit is contained in:
parent
72a3988e49
commit
537a2883bf
|
|
@ -36,12 +36,6 @@ class GraphExplorerService:
|
||||||
|
|
||||||
# --- LEVEL 2: Nachbarn der Nachbarn ---
|
# --- LEVEL 2: Nachbarn der Nachbarn ---
|
||||||
if depth > 1 and level_1_ids:
|
if depth > 1 and level_1_ids:
|
||||||
# Wir suchen Kanten, bei denen Source oder Target einer der L1 Nodes ist
|
|
||||||
# Wichtig: Wir filtern System-Edges schon in der Query oder Python, um Traffic zu sparen
|
|
||||||
|
|
||||||
# Um die Performance zu wahren, limitieren wir die L2 Suche auf die IDs, die wir schon haben (als Source)
|
|
||||||
# Das ist ein "Ego-Network" Ansatz.
|
|
||||||
|
|
||||||
# Wir nehmen alle IDs aus Level 1 (außer Center, das haben wir schon)
|
# Wir nehmen alle IDs aus Level 1 (außer Center, das haben wir schon)
|
||||||
l1_subset = list(level_1_ids - {center_note_id})
|
l1_subset = list(level_1_ids - {center_note_id})
|
||||||
|
|
||||||
|
|
@ -84,8 +78,8 @@ class GraphExplorerService:
|
||||||
if chunk_ids:
|
if chunk_ids:
|
||||||
out_f = models.Filter(must=[
|
out_f = models.Filter(must=[
|
||||||
models.FieldCondition(key="source_id", match=models.MatchAny(any=chunk_ids)),
|
models.FieldCondition(key="source_id", match=models.MatchAny(any=chunk_ids)),
|
||||||
# Filter System Edges
|
# FIX: MatchExcept mit **kwargs nutzen wegen 'except' Keyword
|
||||||
models.FieldCondition(key="kind", match=models.MatchExcept(except_=SYSTEM_EDGES))
|
models.FieldCondition(key="kind", match=models.MatchExcept(**{"except": SYSTEM_EDGES}))
|
||||||
])
|
])
|
||||||
res_out, _ = self.client.scroll(self.edges_col, scroll_filter=out_f, limit=100, with_payload=True)
|
res_out, _ = self.client.scroll(self.edges_col, scroll_filter=out_f, limit=100, with_payload=True)
|
||||||
results.extend(res_out)
|
results.extend(res_out)
|
||||||
|
|
@ -98,7 +92,8 @@ class GraphExplorerService:
|
||||||
|
|
||||||
if shoulds:
|
if shoulds:
|
||||||
in_f = models.Filter(
|
in_f = models.Filter(
|
||||||
must=[models.FieldCondition(key="kind", match=models.MatchExcept(except_=SYSTEM_EDGES))],
|
# FIX: MatchExcept mit **kwargs nutzen wegen 'except' Keyword
|
||||||
|
must=[models.FieldCondition(key="kind", match=models.MatchExcept(**{"except": SYSTEM_EDGES}))],
|
||||||
should=shoulds
|
should=shoulds
|
||||||
)
|
)
|
||||||
res_in, _ = self.client.scroll(self.edges_col, scroll_filter=in_f, limit=100, with_payload=True)
|
res_in, _ = self.client.scroll(self.edges_col, scroll_filter=in_f, limit=100, with_payload=True)
|
||||||
|
|
@ -107,9 +102,7 @@ class GraphExplorerService:
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def _find_connected_edges_batch(self, note_ids):
|
def _find_connected_edges_batch(self, note_ids):
|
||||||
"""Batch-Suche für Level 2 (nur ausgehend und eingehend auf Note-Ebene, keine Title-Suche für Performance)."""
|
"""Batch-Suche für Level 2 (nur ausgehend und eingehend auf Note-Ebene)."""
|
||||||
# Vereinfachte Suche: Wir suchen Kanten, die direkt mit den note_ids (oder deren Chunks) zu tun haben
|
|
||||||
# Um Performance zu sparen, machen wir hier einen simpleren Lookup, wenn möglich.
|
|
||||||
return self._find_connected_edges(note_ids)
|
return self._find_connected_edges(note_ids)
|
||||||
|
|
||||||
def _process_edge(self, record, nodes_dict, unique_edges, current_depth):
|
def _process_edge(self, record, nodes_dict, unique_edges, current_depth):
|
||||||
|
|
@ -165,7 +158,7 @@ class GraphExplorerService:
|
||||||
|
|
||||||
def _resolve_note_from_ref(self, ref_str):
|
def _resolve_note_from_ref(self, ref_str):
|
||||||
if not ref_str: return None
|
if not ref_str: return None
|
||||||
# ... (Logik identisch zu vorher, hier gekürzt für Übersicht)
|
|
||||||
# Fall A: Chunk ID / Section
|
# Fall A: Chunk ID / Section
|
||||||
if "#" in ref_str:
|
if "#" in ref_str:
|
||||||
try:
|
try:
|
||||||
|
|
@ -192,8 +185,8 @@ class GraphExplorerService:
|
||||||
def _add_node_to_dict(self, node_dict, note_payload, level=1):
|
def _add_node_to_dict(self, node_dict, note_payload, level=1):
|
||||||
nid = note_payload.get("note_id")
|
nid = note_payload.get("note_id")
|
||||||
|
|
||||||
# Wenn Node schon da ist, aber wir finden ihn auf einem "höheren" Level (näher am Zentrum), updaten wir ihn nicht zwingend,
|
# Wenn Node schon da ist, aber wir finden ihn auf einem "höheren" Level (näher am Zentrum),
|
||||||
# außer wir wollen visuelle Eigenschaften ändern.
|
# updaten wir ihn nicht zwingend, außer wir wollen visuelle Eigenschaften ändern.
|
||||||
if nid in node_dict: return
|
if nid in node_dict: return
|
||||||
|
|
||||||
ntype = note_payload.get("type", "default")
|
ntype = note_payload.get("type", "default")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user