Skip to content

Commit d90c016

Browse files
committed
Rename searchNodes to searchItems to avoid confusion
1 parent a3f75e8 commit d90c016

File tree

2 files changed

+12
-235
lines changed

2 files changed

+12
-235
lines changed

assets/js/search-page.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function search (value) {
4343
// We cannot match on atoms :foo because that would be considered
4444
// a filter. So we escape all colons not preceded by a word.
4545
const fixedValue = value.replaceAll(/(\B|\\):/g, '\\:')
46-
const results = searchResultsToDecoratedSearchNodes(index.search(fixedValue))
46+
const results = searchResultsToDecoratedSearchItems(index.search(fixedValue))
4747
renderResults({ value, results })
4848
} catch (error) {
4949
renderResults({ value, errorMessage: error.message })
@@ -145,8 +145,8 @@ function createIndex () {
145145
this.use(docTokenSplitter)
146146
this.use(docTrimmer)
147147

148-
searchData.items.forEach(searchNode => {
149-
this.add(searchNode)
148+
searchData.items.forEach(searchItem => {
149+
this.add(searchItem)
150150
})
151151
})
152152
}
@@ -233,29 +233,29 @@ function docTrimmerFunction (token) {
233233
})
234234
}
235235

236-
function searchResultsToDecoratedSearchNodes (results) {
236+
function searchResultsToDecoratedSearchItems (results) {
237237
return results
238238
// If the docs are regenerated without changing its version,
239239
// a reference may have been doc'ed false in the code but
240240
// still available in the cached index, so we skip it here.
241-
.filter(result => getSearchNodeByRef(result.ref))
241+
.filter(result => getSearchItemByRef(result.ref))
242242
.map(result => {
243-
const searchNode = getSearchNodeByRef(result.ref)
243+
const searchItem = getSearchItemByRef(result.ref)
244244
const metadata = result.matchData.metadata
245245
return {
246-
...searchNode,
246+
...searchItem,
247247
metadata,
248-
excerpts: getExcerpts(searchNode, metadata)
248+
excerpts: getExcerpts(searchItem, metadata)
249249
}
250250
})
251251
}
252252

253-
function getSearchNodeByRef (ref) {
254-
return searchData.items.find(searchNode => searchNode.ref === ref) || null
253+
function getSearchItemByRef (ref) {
254+
return searchData.items.find(searchItem => searchItem.ref === ref) || null
255255
}
256256

257-
function getExcerpts (searchNode, metadata) {
258-
const { doc } = searchNode
257+
function getExcerpts (searchItem, metadata) {
258+
const { doc } = searchItem
259259
const searchTerms = Object.keys(metadata)
260260

261261
const excerpts =

0 commit comments

Comments
 (0)