* 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)
| 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. |
no test coverage detected