yangdx commited on
Commit
588a416
·
1 Parent(s): dd22942

Remove reduntant search engine update functions

Browse files
lightrag_webui/src/components/graph/graphSearchUtils.ts CHANGED
@@ -11,18 +11,3 @@ export const searchCache: {
11
  graph: null,
12
  searchEngine: null
13
  }
14
-
15
- export const updateSearchEngine = (nodeId: string, graph: DirectedGraph) => {
16
- if (!searchCache.searchEngine || !graph) return
17
-
18
- const newDocument = {
19
- id: nodeId,
20
- label: graph.getNodeAttribute(nodeId, 'label')
21
- }
22
- searchCache.searchEngine.add(newDocument)
23
- }
24
-
25
- export const removeFromSearchEngine = (nodeId: string) => {
26
- if (!searchCache.searchEngine) return
27
- searchCache.searchEngine.remove({ id: nodeId })
28
- }
 
11
  graph: null,
12
  searchEngine: null
13
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lightrag_webui/src/hooks/useLightragGraph.tsx CHANGED
@@ -11,7 +11,7 @@ import { useSettingsStore } from '@/stores/settings'
11
  import { useTabVisibility } from '@/contexts/useTabVisibility'
12
 
13
  import seedrandom from 'seedrandom'
14
- import { searchCache, updateSearchEngine, removeFromSearchEngine } from '@/components/graph/graphSearchUtils'
15
 
16
  const validateGraph = (graph: RawGraph) => {
17
  if (!graph) {
@@ -538,8 +538,6 @@ const useLightrangeGraph = () => {
538
  rawGraph.nodes.push(newNode);
539
  // Update nodeIdMap
540
  rawGraph.nodeIdMap[nodeId] = rawGraph.nodes.length - 1;
541
- // Update search engine with new node
542
- updateSearchEngine(nodeId, sigmaGraph);
543
  }
544
  }
545
 
@@ -707,8 +705,6 @@ const useLightrangeGraph = () => {
707
 
708
  // Remove from nodeIdMap
709
  delete rawGraph.nodeIdMap[nodeToDelete];
710
- // Remove from search engine
711
- removeFromSearchEngine(nodeToDelete);
712
  }
713
  }
714
 
 
11
  import { useTabVisibility } from '@/contexts/useTabVisibility'
12
 
13
  import seedrandom from 'seedrandom'
14
+ import { searchCache } from '@/components/graph/graphSearchUtils'
15
 
16
  const validateGraph = (graph: RawGraph) => {
17
  if (!graph) {
 
538
  rawGraph.nodes.push(newNode);
539
  // Update nodeIdMap
540
  rawGraph.nodeIdMap[nodeId] = rawGraph.nodes.length - 1;
 
 
541
  }
542
  }
543
 
 
705
 
706
  // Remove from nodeIdMap
707
  delete rawGraph.nodeIdMap[nodeToDelete];
 
 
708
  }
709
  }
710