Skip to content

Commit ea0e58f

Browse files
committed
Updates
1 parent 4ccc317 commit ea0e58f

3 files changed

Lines changed: 4965 additions & 8 deletions

File tree

website/generateTaxonomyFilter.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ print('Extracted nodes.dmp')
4343
)
4444
}
4545

46-
async function buildChildrenMap(filePath: string): Promise<Map<number, number[]>> {
46+
async function buildChildrenMap(
47+
filePath: string,
48+
): Promise<Map<number, number[]>> {
4749
const childrenMap = new Map<number, number[]>()
4850
const rl = readline.createInterface({
4951
input: fs.createReadStream(filePath),
@@ -93,12 +95,20 @@ function collectDescendants(
9395

9496
ensureNodesDmp()
9597

96-
const searchIndex = JSON.parse(
97-
fs.readFileSync(SEARCH_INDEX_PATH, 'utf-8'),
98-
) as [string, string, string, string, string, string, number][]
98+
const searchIndex = JSON.parse(fs.readFileSync(SEARCH_INDEX_PATH, 'utf-8')) as [
99+
string,
100+
string,
101+
string,
102+
string,
103+
string,
104+
string,
105+
number,
106+
][]
99107

100108
const indexTaxonIds = new Set(searchIndex.map(e => e[6]).filter(id => id > 0))
101-
console.log(`Search index: ${searchIndex.length} entries, ${indexTaxonIds.size} unique taxonIds`)
109+
console.log(
110+
`Search index: ${searchIndex.length} entries, ${indexTaxonIds.size} unique taxonIds`,
111+
)
102112

103113
console.log('Parsing nodes.dmp...')
104114
const childrenMap = await buildChildrenMap(NODES_DMP_PATH)
@@ -114,7 +124,9 @@ for (const { label, taxonId } of CURATED_CLADES) {
114124
}
115125
}
116126
result[label] = members
117-
console.log(` ${label} (taxonId ${taxonId}): ${members.length} matching taxonIds`)
127+
console.log(
128+
` ${label} (taxonId ${taxonId}): ${members.length} matching taxonIds`,
129+
)
118130
}
119131

120132
fs.writeFileSync(OUTPUT_PATH, JSON.stringify(result))

website/public/taxonomyFilter.json

Lines changed: 4943 additions & 1 deletion
Large diffs are not rendered by default.

website/src/components/SearchPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import { Search } from 'lucide-react'
44

55
import styles from './SearchPage.module.css'
66
import { useSearchIndex } from '../hooks/useSearchIndex.ts'
7-
import { useTaxonomyFilter, CURATED_CLADES } from '../hooks/useTaxonomyFilter.ts'
7+
import {
8+
useTaxonomyFilter,
9+
CURATED_CLADES,
10+
} from '../hooks/useTaxonomyFilter.ts'
811

912
import type { IndexEntry } from '../hooks/useSearchIndex.ts'
1013

0 commit comments

Comments
 (0)