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

Method searchContains

packages/graph/src/indexes/FullTextIndex.ts:174–190  ·  view source on GitHub ↗

* Find documents where the text contains the given substring. * No relevance scoring - returns all matches. * * @param substring The substring to search for. * @returns Set of element IDs containing the substring.

(substring: string)

Source from the content-addressed store, hash-verified

172 * @returns Set of element IDs containing the substring.
173 */
174 public searchContains(substring: string): Set<ElementId> {
175 const result = new Set<ElementId>();
176
177 if (!substring || substring.length === 0) {
178 return result;
179 }
180
181 const normalizedSubstring = substring.toLowerCase();
182
183 for (const [elementId, text] of this.#documents) {
184 if (text.toLowerCase().includes(normalizedSubstring)) {
185 result.add(elementId);
186 }
187 }
188
189 return result;
190 }
191
192 /**
193 * Find documents where the text starts with the given prefix.

Callers 2

#performIndexLookupMethod · 0.80
indexes.test.tsFile · 0.80

Calls 1

addMethod · 0.65

Tested by

no test coverage detected