Repository navigation
Commit a99b2b1
[repo-assist] perf: index related section lookups (#1416)
🤖 *This is an automated PR from Repo Assist, an AI assistant for this
repository.*
## Summary
`FindRelatedSections` previously searched every site mapping for each
semantic result. This change builds a per-request chapter/heading index
once and uses dictionary lookups, reducing the mapping phase from
O(results × mappings) to O(mappings + results) while preserving
case-insensitive matching and first-match behavior.
## Root cause and rationale
Related-section results performed a linear scan of the complete
site-mapping collection for every result. As the book mapping grows,
that repeated work scales unnecessarily. The local index keeps the
existing result and fallback behavior but avoids repeated enumeration.
## Test Status
- ✅ `dotnet build EssentialCSharp.Web/EssentialCSharp.Web.csproj
--configuration Release --no-restore`
- 1 parent 0b87c76 commit a99b2b1
1 file changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
325 | 337 | | |
326 | 338 | | |
327 | 339 | | |
328 | 340 | | |
329 | 341 | | |
330 | 342 | | |
331 | 343 | | |
332 | | - | |
333 | | - | |
334 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
335 | 348 | | |
336 | 349 | | |
337 | 350 | | |
| |||
0 commit comments