cache: heuristic for removing years showing up in search
commit3c1b491e02fb86722294f4e6edd897177ca809a6
authorMatilde Park <matilde.park@urbit.org>
dateMon 31 Oct 2022, 17:08 (4 years ago)
parenta588ea4
lib/cache.js+5−1
@@ -15,10 +15,14 @@ const options = {
1515const index = [];
1616
1717function buildSearchIndex(dir) {
18+ // Assume years belong to Grants for now.
1819 const dirName = dir.split("/").slice(-1).join("");
20+ const parentName = String(Number(dirName)).length === 4
21+ ? "Grants"
22+ : dirName.charAt(0).toUpperCase() + dirName.slice(1);
1923 let metadata = {
2024 data: {
21− title: dirName.charAt(0).toUpperCase() + dirName.slice(1),
25+ title: parentName,
2226 },
2327 };
2428