Commit 0cf4143
Update search UI for DocSearch content indexing (#845)
* Update Algolia search to display DocSearch hierarchy and content snippets
Support the richer record format from helpers.docsearch() crawler config:
heading hierarchy breadcrumbs, content snippet highlighting, and proper
anchor-based navigation. Backward compatible with legacy flat records.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Address review feedback on search component
- Fix key collision risk in Breadcrumb (use index-prefixed key)
- Remove unnecessary optional chain on hit.type (required field)
- Drop lvl6 from type and hierarchy (crawler only uses lvl0-lvl5)
- Remove unreachable fallback in getHitUrl (url is required string)
- Use explicit distinct={true} for consistency with other props
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Restore optional chain on hit.type for legacy record compatibility
Legacy records from the old _pages index don't have a type field,
so hit.type is undefined at runtime. Without optional chaining,
hit.type.startsWith() throws a TypeError before reaching the
legacy title fallback. Make type optional in the type definition
to match.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix duplicate heading in breadcrumb and title for content hits
Content-type hits showed the deepest heading in both the breadcrumb
trail and the title. Apply the same slice(0, -1) used for heading
hits so the breadcrumb always excludes the level shown as the title.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent d12db22 commit 0cf4143
1 file changed
Lines changed: 124 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
15 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
16 | 33 | | |
17 | 34 | | |
18 | | - | |
19 | 35 | | |
20 | 36 | | |
21 | 37 | | |
| |||
38 | 54 | | |
39 | 55 | | |
40 | 56 | | |
41 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
42 | 146 | | |
43 | 147 | | |
44 | 148 | | |
45 | | - | |
| 149 | + | |
46 | 150 | | |
| 151 | + | |
47 | 152 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 153 | + | |
52 | 154 | | |
53 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
54 | 161 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 162 | + | |
59 | 163 | | |
60 | 164 | | |
61 | 165 | | |
| |||
146 | 250 | | |
147 | 251 | | |
148 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
149 | 259 | | |
150 | 260 | | |
151 | 261 | | |
| |||
168 | 278 | | |
169 | 279 | | |
170 | 280 | | |
171 | | - | |
| 281 | + | |
172 | 282 | | |
173 | 283 | | |
174 | 284 | | |
| |||
0 commit comments