24 |
|
|
25 |
if (lowercasedIndex) { |
if (lowercasedIndex) { |
26 |
for (const i in lowercasedIndex) { |
for (const i in lowercasedIndex) { |
27 |
|
if (results.length >= 15) { |
28 |
|
break; |
29 |
|
} |
30 |
|
|
31 |
const titleIncludes = lowercasedIndex[i].title?.includes(query); |
const titleIncludes = lowercasedIndex[i].title?.includes(query); |
32 |
const descriptionIncludes = |
const descriptionIncludes = |
33 |
lowercasedIndex[i].description?.includes(query); |
lowercasedIndex[i].description?.includes(query); |
39 |
match: titleIncludes |
match: titleIncludes |
40 |
? ("title" as const) |
? ("title" as const) |
41 |
: descriptionIncludes |
: descriptionIncludes |
42 |
? ("description" as const) |
? ("description" as const) |
43 |
: ("data" as const), |
: ("data" as const), |
44 |
}); |
}); |
45 |
} |
} |
46 |
} |
} |