* Find documents where the text starts with the given prefix. * No relevance scoring - returns all matches. * * @param prefix The prefix to search for. * @returns Set of element IDs starting with the prefix.
(prefix: string)
| 197 | * @returns Set of element IDs starting with the prefix. |
| 198 | */ |
| 199 | public searchPrefix(prefix: string): Set<ElementId> { |
| 200 | const result = new Set<ElementId>(); |
| 201 | |
| 202 | if (!prefix || prefix.length === 0) { |
| 203 | return result; |
| 204 | } |
| 205 | |
| 206 | const normalizedPrefix = prefix.toLowerCase(); |
| 207 | |
| 208 | for (const [elementId, text] of this.#documents) { |
| 209 | if (text.toLowerCase().startsWith(normalizedPrefix)) { |
| 210 | result.add(elementId); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | return result; |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * Find documents where any indexed term starts with the given prefix. |
no test coverage detected