From 75ea0bc38de3b519d2389c8b25988df914591f3b Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 29 Jun 2025 22:05:48 +0800 Subject: [PATCH] Remove default get_nodes_by_chunk_ids implementation - Deletes inefficient default implementation - Makes method purely abstract --- lightrag/base.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lightrag/base.py b/lightrag/base.py index c6811471..36c3ff59 100644 --- a/lightrag/base.py +++ b/lightrag/base.py @@ -470,17 +470,6 @@ class BaseGraphStorage(StorageNameSpace, ABC): list[dict]: A list of nodes, where each node is a dictionary of its properties. An empty list if no matching nodes are found. """ - # Default implementation iterates through all nodes, which is inefficient. - # This method should be overridden by subclasses for better performance. - all_nodes = [] - all_labels = await self.get_all_labels() - for label in all_labels: - node = await self.get_node(label) - if node and "source_id" in node: - source_ids = set(node["source_id"].split(GRAPH_FIELD_SEP)) - if not source_ids.isdisjoint(chunk_ids): - all_nodes.append(node) - return all_nodes @abstractmethod async def get_edges_by_chunk_ids(self, chunk_ids: list[str]) -> list[dict]: