MCPcopy Create free account
hub / github.com/codemix/graph / remove

Method remove

packages/graph/src/indexes/FullTextIndex.ts:76–96  ·  view source on GitHub ↗
(elementId: ElementId, _value: unknown)

Source from the content-addressed store, hash-verified

74 }
75
76 public remove(elementId: ElementId, _value: unknown): void {
77 const storedText = this.#documents.get(elementId);
78 if (!storedText) {
79 return;
80 }
81
82 // Remove from inverted index
83 const terms = extractTerms(storedText, this.#options);
84
85 for (const term of terms) {
86 const ids = this.#invertedIndex.get(term);
87 if (ids) {
88 ids.delete(elementId);
89 if (ids.size === 0) {
90 this.#invertedIndex.delete(term);
91 }
92 }
93 }
94
95 this.#documents.delete(elementId);
96 }
97
98 public update(elementId: ElementId, oldValue: unknown, newValue: unknown): void {
99 this.remove(elementId, oldValue);

Callers 1

updateMethod · 0.95

Calls 2

extractTermsFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected