@mailwoman/resolver-wof-sqlite 9.1.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -9
- package/address-point-interpolation.ts +18 -8
- package/address-point-schema.ts +18 -6
- package/address-point.ts +111 -18
- package/ancestry.ts +9 -6
- package/build-candidate.ts +200 -163
- package/build-slim.ts +3 -3
- package/candidate/alias-bags.ts +54 -0
- package/candidate/ancestors-sidecar.ts +206 -0
- package/candidate/country-display-names.ts +79 -0
- package/candidate/name-roles.ts +237 -0
- package/candidate/own-name.ts +146 -0
- package/candidate/place-attrs.ts +44 -0
- package/candidate/shard-fold.ts +137 -0
- package/candidate-ancestors-schema.ts +195 -0
- package/candidate-fts.ts +4 -2
- package/candidate-importance.ts +2 -1
- package/candidate-lookup.ts +439 -186
- package/candidate-schema.ts +33 -5
- package/candidate-scoring.ts +268 -0
- package/capital-schema.ts +90 -0
- package/capitals.ts +148 -0
- package/coincident-roles.ts +69 -10
- package/convention-schema.ts +72 -0
- package/convention.ts +2 -2
- package/coverage-manifest-schema.ts +7 -7
- package/currency-backfill.ts +249 -0
- package/exact-match.ts +104 -0
- package/fst-autocomplete.ts +91 -119
- package/fst-builder.ts +14 -12
- package/fst-freshness.ts +2 -2
- package/fts-query.ts +1 -1
- package/fts.ts +4 -4
- package/geonames-postal.ts +2 -2
- package/index.ts +18 -14
- package/interpolation.ts +113 -19
- package/lookup.ts +110 -591
- package/name-score.ts +6 -4
- package/out/address-point-interpolation.d.ts.map +1 -1
- package/out/address-point-interpolation.js +13 -7
- package/out/address-point-interpolation.js.map +1 -1
- package/out/address-point-schema.d.ts +16 -6
- package/out/address-point-schema.d.ts.map +1 -1
- package/out/address-point-schema.js.map +1 -1
- package/out/address-point.d.ts.map +1 -1
- package/out/address-point.js +70 -14
- package/out/address-point.js.map +1 -1
- package/out/ancestry.d.ts +2 -2
- package/out/ancestry.d.ts.map +1 -1
- package/out/ancestry.js +5 -6
- package/out/ancestry.js.map +1 -1
- package/out/build-candidate.d.ts +75 -0
- package/out/build-candidate.d.ts.map +1 -1
- package/out/build-candidate.js +120 -122
- package/out/build-candidate.js.map +1 -1
- package/out/build-slim.d.ts +1 -1
- package/out/build-slim.js +3 -3
- package/out/build-slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +17 -0
- package/out/candidate/alias-bags.d.ts.map +1 -0
- package/out/candidate/alias-bags.js +39 -0
- package/out/candidate/alias-bags.js.map +1 -0
- package/out/candidate/ancestors-sidecar.d.ts +33 -0
- package/out/candidate/ancestors-sidecar.d.ts.map +1 -0
- package/out/candidate/ancestors-sidecar.js +140 -0
- package/out/candidate/ancestors-sidecar.js.map +1 -0
- package/out/candidate/country-display-names.d.ts +35 -0
- package/out/candidate/country-display-names.d.ts.map +1 -0
- package/out/candidate/country-display-names.js +59 -0
- package/out/candidate/country-display-names.js.map +1 -0
- package/out/candidate/name-roles.d.ts +55 -0
- package/out/candidate/name-roles.d.ts.map +1 -0
- package/out/candidate/name-roles.js +165 -0
- package/out/candidate/name-roles.js.map +1 -0
- package/out/candidate/own-name.d.ts +50 -0
- package/out/candidate/own-name.d.ts.map +1 -0
- package/out/candidate/own-name.js +132 -0
- package/out/candidate/own-name.js.map +1 -0
- package/out/candidate/place-attrs.d.ts +43 -0
- package/out/candidate/place-attrs.d.ts.map +1 -0
- package/out/candidate/place-attrs.js +15 -0
- package/out/candidate/place-attrs.js.map +1 -0
- package/out/candidate/shard-fold.d.ts +31 -0
- package/out/candidate/shard-fold.d.ts.map +1 -0
- package/out/candidate/shard-fold.js +104 -0
- package/out/candidate/shard-fold.js.map +1 -0
- package/out/candidate-ancestors-schema.d.ts +150 -0
- package/out/candidate-ancestors-schema.d.ts.map +1 -0
- package/out/candidate-ancestors-schema.js +123 -0
- package/out/candidate-ancestors-schema.js.map +1 -0
- package/out/candidate-fts.d.ts +4 -2
- package/out/candidate-fts.d.ts.map +1 -1
- package/out/candidate-fts.js +4 -2
- package/out/candidate-fts.js.map +1 -1
- package/out/candidate-importance.d.ts.map +1 -1
- package/out/candidate-importance.js +1 -1
- package/out/candidate-importance.js.map +1 -1
- package/out/candidate-lookup.d.ts +22 -45
- package/out/candidate-lookup.d.ts.map +1 -1
- package/out/candidate-lookup.js +340 -135
- package/out/candidate-lookup.js.map +1 -1
- package/out/candidate-schema.d.ts +30 -6
- package/out/candidate-schema.d.ts.map +1 -1
- package/out/candidate-schema.js +3 -0
- package/out/candidate-schema.js.map +1 -1
- package/out/candidate-scoring.d.ts +34 -0
- package/out/candidate-scoring.d.ts.map +1 -0
- package/out/candidate-scoring.js +200 -0
- package/out/candidate-scoring.js.map +1 -0
- package/out/capital-schema.d.ts +51 -0
- package/out/capital-schema.d.ts.map +1 -0
- package/out/capital-schema.js +63 -0
- package/out/capital-schema.js.map +1 -0
- package/out/capitals.d.ts +69 -0
- package/out/capitals.d.ts.map +1 -0
- package/out/capitals.js +98 -0
- package/out/capitals.js.map +1 -0
- package/out/coincident-roles.d.ts +7 -0
- package/out/coincident-roles.d.ts.map +1 -1
- package/out/coincident-roles.js +42 -8
- package/out/coincident-roles.js.map +1 -1
- package/out/convention-schema.d.ts +51 -0
- package/out/convention-schema.d.ts.map +1 -0
- package/out/convention-schema.js +34 -0
- package/out/convention-schema.js.map +1 -0
- package/out/convention.d.ts +1 -1
- package/out/convention.js +2 -2
- package/out/coverage-manifest-schema.js +3 -7
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/currency-backfill.d.ts +46 -0
- package/out/currency-backfill.d.ts.map +1 -0
- package/out/currency-backfill.js +180 -0
- package/out/currency-backfill.js.map +1 -0
- package/out/exact-match.d.ts +25 -0
- package/out/exact-match.d.ts.map +1 -0
- package/out/exact-match.js +89 -0
- package/out/exact-match.js.map +1 -0
- package/out/fst-autocomplete.d.ts +11 -11
- package/out/fst-autocomplete.d.ts.map +1 -1
- package/out/fst-autocomplete.js +82 -99
- package/out/fst-autocomplete.js.map +1 -1
- package/out/fst-builder.d.ts.map +1 -1
- package/out/fst-builder.js +11 -12
- package/out/fst-builder.js.map +1 -1
- package/out/fst-freshness.d.ts +2 -2
- package/out/fst-freshness.js +2 -2
- package/out/fts-query.js +1 -1
- package/out/fts-query.js.map +1 -1
- package/out/fts.d.ts +4 -4
- package/out/fts.js +4 -4
- package/out/geonames-postal.d.ts +2 -2
- package/out/geonames-postal.js +2 -2
- package/out/index.d.ts +3 -2
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -2
- package/out/index.js.map +1 -1
- package/out/interpolation.d.ts +8 -0
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +91 -19
- package/out/interpolation.js.map +1 -1
- package/out/lookup.d.ts +4 -5
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +94 -468
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts +0 -10
- package/out/name-score.d.ts.map +1 -1
- package/out/name-score.js +6 -4
- package/out/name-score.js.map +1 -1
- package/out/place-importance-schema.d.ts +42 -5
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +54 -8
- package/out/place-importance-schema.js.map +1 -1
- package/out/poi-lookup.d.ts +1 -1
- package/out/poi-lookup.d.ts.map +1 -1
- package/out/poi-lookup.js +12 -13
- package/out/poi-lookup.js.map +1 -1
- package/out/poi-schema.d.ts +7 -3
- package/out/poi-schema.d.ts.map +1 -1
- package/out/poi-schema.js.map +1 -1
- package/out/polygon-schema.d.ts +37 -0
- package/out/polygon-schema.d.ts.map +1 -0
- package/out/polygon-schema.js +23 -0
- package/out/polygon-schema.js.map +1 -0
- package/out/postal-city-alias-lookup.d.ts +1 -1
- package/out/postal-city-alias-lookup.js +1 -1
- package/out/postal-city-candidate-schema.d.ts +2 -1
- package/out/postal-city-candidate-schema.d.ts.map +1 -1
- package/out/postal-city-candidate-schema.js.map +1 -1
- package/out/postcode-point-lookup.d.ts +1 -1
- package/out/postcode-point-lookup.js +1 -1
- package/out/primary-preference.d.ts +125 -0
- package/out/primary-preference.d.ts.map +1 -0
- package/out/primary-preference.js +138 -0
- package/out/primary-preference.js.map +1 -0
- package/out/proximity-rerank.d.ts +77 -0
- package/out/proximity-rerank.d.ts.map +1 -0
- package/out/proximity-rerank.js +86 -0
- package/out/proximity-rerank.js.map +1 -0
- package/out/region-keys.d.ts +47 -0
- package/out/region-keys.d.ts.map +1 -0
- package/out/region-keys.js +121 -0
- package/out/region-keys.js.map +1 -0
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +6 -9
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +1 -1
- package/out/search-fetch.d.ts +57 -0
- package/out/search-fetch.d.ts.map +1 -0
- package/out/search-fetch.js +183 -0
- package/out/search-fetch.js.map +1 -0
- package/out/sharding.d.ts +3 -3
- package/out/sharding.js +1 -1
- package/out/sqlite-convention-source.d.ts +1 -1
- package/out/sqlite-convention-source.js +1 -1
- package/out/sqlite-utils.d.ts +19 -1
- package/out/sqlite-utils.d.ts.map +1 -1
- package/out/sqlite-utils.js +19 -1
- package/out/sqlite-utils.js.map +1 -1
- package/out/street-centroid-schema.d.ts +7 -2
- package/out/street-centroid-schema.d.ts.map +1 -1
- package/out/street-centroid-schema.js.map +1 -1
- package/out/street-centroid.d.ts.map +1 -1
- package/out/street-centroid.js +7 -7
- package/out/street-centroid.js.map +1 -1
- package/out/street-normalize.d.ts +82 -9
- package/out/street-normalize.d.ts.map +1 -1
- package/out/street-normalize.js +175 -9
- package/out/street-normalize.js.map +1 -1
- package/out/street-segment-schema.d.ts +6 -2
- package/out/street-segment-schema.d.ts.map +1 -1
- package/out/street-segment-schema.js.map +1 -1
- package/out/types.d.ts +35 -1
- package/out/types.d.ts.map +1 -1
- package/out/unified-schema.d.ts +1 -1
- package/out/unified-schema.js +1 -1
- package/out/uprn-lookup.d.ts +85 -0
- package/out/uprn-lookup.d.ts.map +1 -0
- package/out/uprn-lookup.js +152 -0
- package/out/uprn-lookup.js.map +1 -0
- package/out/uprn-schema.d.ts +93 -0
- package/out/uprn-schema.d.ts.map +1 -0
- package/out/uprn-schema.js +78 -0
- package/out/uprn-schema.js.map +1 -0
- package/out/weights-overlay-linker.d.ts +141 -0
- package/out/weights-overlay-linker.d.ts.map +1 -0
- package/out/weights-overlay-linker.js +259 -0
- package/out/weights-overlay-linker.js.map +1 -0
- package/package.json +288 -16
- package/place-importance-schema.ts +64 -15
- package/poi-lookup.ts +12 -13
- package/poi-schema.ts +8 -3
- package/polygon-schema.ts +47 -0
- package/postal-city-alias-lookup.ts +1 -1
- package/postal-city-candidate-schema.ts +3 -1
- package/postcode-point-lookup.ts +1 -1
- package/primary-preference.ts +207 -0
- package/proximity-rerank.ts +120 -0
- package/region-keys.ts +144 -0
- package/reverse.ts +17 -16
- package/schema.ts +1 -1
- package/search-fetch.ts +256 -0
- package/sharding.ts +3 -3
- package/sqlite-convention-source.ts +1 -1
- package/sqlite-utils.ts +43 -2
- package/street-centroid-schema.ts +8 -2
- package/street-centroid.ts +13 -8
- package/street-normalize.ts +252 -23
- package/street-segment-schema.ts +7 -2
- package/types.ts +35 -1
- package/unified-schema.ts +1 -1
- package/uprn-lookup.ts +210 -0
- package/uprn-schema.ts +124 -0
- package/weights-overlay-linker.ts +377 -0
- package/geo.ts +0 -121
- package/out/geo.d.ts +0 -74
- package/out/geo.d.ts.map +0 -1
- package/out/geo.js +0 -71
- package/out/geo.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/resolver-wof-sqlite",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "Who's On First SQLite resolver — FTS5-backed PlaceLookup that resolves text queries to WOF place IDs + coordinates. Optional dependency for callers who want geocoding.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/sister-software/mailwoman.git",
|
|
9
|
-
"directory": "resolver-wof-sqlite"
|
|
9
|
+
"directory": "packages/resolver-wof-sqlite"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"out/**/*.js",
|
|
@@ -21,9 +21,28 @@
|
|
|
21
21
|
"!*.test.ts",
|
|
22
22
|
"!*.test.tsx",
|
|
23
23
|
"!**/*.test.ts",
|
|
24
|
-
"!**/*.test.tsx"
|
|
24
|
+
"!**/*.test.tsx",
|
|
25
|
+
"!test/**"
|
|
25
26
|
],
|
|
26
27
|
"type": "module",
|
|
28
|
+
"imports": {
|
|
29
|
+
"#candidate/alias-bags": {
|
|
30
|
+
"types": "./out/candidate/alias-bags.d.ts",
|
|
31
|
+
"default": "./out/candidate/alias-bags.js"
|
|
32
|
+
},
|
|
33
|
+
"#candidate/name-roles": {
|
|
34
|
+
"types": "./out/candidate/name-roles.d.ts",
|
|
35
|
+
"default": "./out/candidate/name-roles.js"
|
|
36
|
+
},
|
|
37
|
+
"#candidate/place-attrs": {
|
|
38
|
+
"types": "./out/candidate/place-attrs.d.ts",
|
|
39
|
+
"default": "./out/candidate/place-attrs.js"
|
|
40
|
+
},
|
|
41
|
+
"#sqlite-utils": {
|
|
42
|
+
"types": "./out/sqlite-utils.d.ts",
|
|
43
|
+
"default": "./out/sqlite-utils.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
27
46
|
"exports": {
|
|
28
47
|
"./package.json": "./package.json",
|
|
29
48
|
".": {
|
|
@@ -34,6 +53,30 @@
|
|
|
34
53
|
"types": "./out/fts.d.ts",
|
|
35
54
|
"default": "./out/fts.js"
|
|
36
55
|
},
|
|
56
|
+
"./fts-query": {
|
|
57
|
+
"types": "./out/fts-query.d.ts",
|
|
58
|
+
"default": "./out/fts-query.js"
|
|
59
|
+
},
|
|
60
|
+
"./primary-preference": {
|
|
61
|
+
"types": "./out/primary-preference.d.ts",
|
|
62
|
+
"default": "./out/primary-preference.js"
|
|
63
|
+
},
|
|
64
|
+
"./capitals": {
|
|
65
|
+
"types": "./out/capitals.d.ts",
|
|
66
|
+
"default": "./out/capitals.js"
|
|
67
|
+
},
|
|
68
|
+
"./capital-schema": {
|
|
69
|
+
"types": "./out/capital-schema.d.ts",
|
|
70
|
+
"default": "./out/capital-schema.js"
|
|
71
|
+
},
|
|
72
|
+
"./candidate/own-name": {
|
|
73
|
+
"types": "./out/candidate/own-name.d.ts",
|
|
74
|
+
"default": "./out/candidate/own-name.js"
|
|
75
|
+
},
|
|
76
|
+
"./proximity-rerank": {
|
|
77
|
+
"types": "./out/proximity-rerank.d.ts",
|
|
78
|
+
"default": "./out/proximity-rerank.js"
|
|
79
|
+
},
|
|
37
80
|
"./build-slim": {
|
|
38
81
|
"types": "./out/build-slim.d.ts",
|
|
39
82
|
"default": "./out/build-slim.js"
|
|
@@ -98,18 +141,22 @@
|
|
|
98
141
|
"types": "./out/geonames-postal.d.ts",
|
|
99
142
|
"default": "./out/geonames-postal.js"
|
|
100
143
|
},
|
|
101
|
-
"./geo": {
|
|
102
|
-
"types": "./out/geo.d.ts",
|
|
103
|
-
"default": "./out/geo.js"
|
|
104
|
-
},
|
|
105
144
|
"./street-normalize": {
|
|
106
145
|
"types": "./out/street-normalize.d.ts",
|
|
107
146
|
"default": "./out/street-normalize.js"
|
|
108
147
|
},
|
|
148
|
+
"./region-keys": {
|
|
149
|
+
"types": "./out/region-keys.d.ts",
|
|
150
|
+
"default": "./out/region-keys.js"
|
|
151
|
+
},
|
|
109
152
|
"./build-candidate": {
|
|
110
153
|
"types": "./out/build-candidate.d.ts",
|
|
111
154
|
"default": "./out/build-candidate.js"
|
|
112
155
|
},
|
|
156
|
+
"./candidate-ancestors-schema": {
|
|
157
|
+
"types": "./out/candidate-ancestors-schema.d.ts",
|
|
158
|
+
"default": "./out/candidate-ancestors-schema.js"
|
|
159
|
+
},
|
|
113
160
|
"./candidate-schema": {
|
|
114
161
|
"types": "./out/candidate-schema.d.ts",
|
|
115
162
|
"default": "./out/candidate-schema.js"
|
|
@@ -137,6 +184,94 @@
|
|
|
137
184
|
"./poi-lookup": {
|
|
138
185
|
"types": "./out/poi-lookup.d.ts",
|
|
139
186
|
"default": "./out/poi-lookup.js"
|
|
187
|
+
},
|
|
188
|
+
"./uprn-schema": {
|
|
189
|
+
"types": "./out/uprn-schema.d.ts",
|
|
190
|
+
"default": "./out/uprn-schema.js"
|
|
191
|
+
},
|
|
192
|
+
"./uprn-lookup": {
|
|
193
|
+
"types": "./out/uprn-lookup.d.ts",
|
|
194
|
+
"default": "./out/uprn-lookup.js"
|
|
195
|
+
},
|
|
196
|
+
"./weights-overlay-linker": {
|
|
197
|
+
"types": "./out/weights-overlay-linker.d.ts",
|
|
198
|
+
"default": "./out/weights-overlay-linker.js"
|
|
199
|
+
},
|
|
200
|
+
"./address-point-interpolation": {
|
|
201
|
+
"types": "./out/address-point-interpolation.d.ts",
|
|
202
|
+
"default": "./out/address-point-interpolation.js"
|
|
203
|
+
},
|
|
204
|
+
"./interpolation": {
|
|
205
|
+
"types": "./out/interpolation.d.ts",
|
|
206
|
+
"default": "./out/interpolation.js"
|
|
207
|
+
},
|
|
208
|
+
"./address-point": {
|
|
209
|
+
"types": "./out/address-point.d.ts",
|
|
210
|
+
"default": "./out/address-point.js"
|
|
211
|
+
},
|
|
212
|
+
"./ancestry": {
|
|
213
|
+
"types": "./out/ancestry.d.ts",
|
|
214
|
+
"default": "./out/ancestry.js"
|
|
215
|
+
},
|
|
216
|
+
"./candidate-lookup": {
|
|
217
|
+
"types": "./out/candidate-lookup.d.ts",
|
|
218
|
+
"default": "./out/candidate-lookup.js"
|
|
219
|
+
},
|
|
220
|
+
"./candidate-importance": {
|
|
221
|
+
"types": "./out/candidate-importance.d.ts",
|
|
222
|
+
"default": "./out/candidate-importance.js"
|
|
223
|
+
},
|
|
224
|
+
"./types": {
|
|
225
|
+
"types": "./out/types.d.ts",
|
|
226
|
+
"default": "./out/types.js"
|
|
227
|
+
},
|
|
228
|
+
"./lookup": {
|
|
229
|
+
"types": "./out/lookup.d.ts",
|
|
230
|
+
"default": "./out/lookup.js"
|
|
231
|
+
},
|
|
232
|
+
"./convention": {
|
|
233
|
+
"types": "./out/convention.d.ts",
|
|
234
|
+
"default": "./out/convention.js"
|
|
235
|
+
},
|
|
236
|
+
"./postal-city-alias-lookup": {
|
|
237
|
+
"types": "./out/postal-city-alias-lookup.d.ts",
|
|
238
|
+
"default": "./out/postal-city-alias-lookup.js"
|
|
239
|
+
},
|
|
240
|
+
"./postal-city-candidate-schema": {
|
|
241
|
+
"types": "./out/postal-city-candidate-schema.d.ts",
|
|
242
|
+
"default": "./out/postal-city-candidate-schema.js"
|
|
243
|
+
},
|
|
244
|
+
"./postcode-point-lookup": {
|
|
245
|
+
"types": "./out/postcode-point-lookup.d.ts",
|
|
246
|
+
"default": "./out/postcode-point-lookup.js"
|
|
247
|
+
},
|
|
248
|
+
"./reverse": {
|
|
249
|
+
"types": "./out/reverse.d.ts",
|
|
250
|
+
"default": "./out/reverse.js"
|
|
251
|
+
},
|
|
252
|
+
"./sharding": {
|
|
253
|
+
"types": "./out/sharding.d.ts",
|
|
254
|
+
"default": "./out/sharding.js"
|
|
255
|
+
},
|
|
256
|
+
"./sqlite-convention-source": {
|
|
257
|
+
"types": "./out/sqlite-convention-source.d.ts",
|
|
258
|
+
"default": "./out/sqlite-convention-source.js"
|
|
259
|
+
},
|
|
260
|
+
"./street-centroid": {
|
|
261
|
+
"types": "./out/street-centroid.d.ts",
|
|
262
|
+
"default": "./out/street-centroid.js"
|
|
263
|
+
},
|
|
264
|
+
"./street-name-lookup": {
|
|
265
|
+
"types": "./out/street-name-lookup.d.ts",
|
|
266
|
+
"default": "./out/street-name-lookup.js"
|
|
267
|
+
},
|
|
268
|
+
"./convention-schema": {
|
|
269
|
+
"types": "./out/convention-schema.d.ts",
|
|
270
|
+
"default": "./out/convention-schema.js"
|
|
271
|
+
},
|
|
272
|
+
"./polygon-schema": {
|
|
273
|
+
"types": "./out/polygon-schema.d.ts",
|
|
274
|
+
"default": "./out/polygon-schema.js"
|
|
140
275
|
}
|
|
141
276
|
},
|
|
142
277
|
"publishConfig": {
|
|
@@ -151,6 +286,30 @@
|
|
|
151
286
|
"types": "./out/fts.d.ts",
|
|
152
287
|
"default": "./out/fts.js"
|
|
153
288
|
},
|
|
289
|
+
"./fts-query": {
|
|
290
|
+
"types": "./out/fts-query.d.ts",
|
|
291
|
+
"default": "./out/fts-query.js"
|
|
292
|
+
},
|
|
293
|
+
"./primary-preference": {
|
|
294
|
+
"types": "./out/primary-preference.d.ts",
|
|
295
|
+
"default": "./out/primary-preference.js"
|
|
296
|
+
},
|
|
297
|
+
"./capitals": {
|
|
298
|
+
"types": "./out/capitals.d.ts",
|
|
299
|
+
"default": "./out/capitals.js"
|
|
300
|
+
},
|
|
301
|
+
"./capital-schema": {
|
|
302
|
+
"types": "./out/capital-schema.d.ts",
|
|
303
|
+
"default": "./out/capital-schema.js"
|
|
304
|
+
},
|
|
305
|
+
"./candidate/own-name": {
|
|
306
|
+
"types": "./out/candidate/own-name.d.ts",
|
|
307
|
+
"default": "./out/candidate/own-name.js"
|
|
308
|
+
},
|
|
309
|
+
"./proximity-rerank": {
|
|
310
|
+
"types": "./out/proximity-rerank.d.ts",
|
|
311
|
+
"default": "./out/proximity-rerank.js"
|
|
312
|
+
},
|
|
154
313
|
"./build-slim": {
|
|
155
314
|
"types": "./out/build-slim.d.ts",
|
|
156
315
|
"default": "./out/build-slim.js"
|
|
@@ -215,18 +374,22 @@
|
|
|
215
374
|
"types": "./out/geonames-postal.d.ts",
|
|
216
375
|
"default": "./out/geonames-postal.js"
|
|
217
376
|
},
|
|
218
|
-
"./geo": {
|
|
219
|
-
"types": "./out/geo.d.ts",
|
|
220
|
-
"default": "./out/geo.js"
|
|
221
|
-
},
|
|
222
377
|
"./street-normalize": {
|
|
223
378
|
"types": "./out/street-normalize.d.ts",
|
|
224
379
|
"default": "./out/street-normalize.js"
|
|
225
380
|
},
|
|
381
|
+
"./region-keys": {
|
|
382
|
+
"types": "./out/region-keys.d.ts",
|
|
383
|
+
"default": "./out/region-keys.js"
|
|
384
|
+
},
|
|
226
385
|
"./build-candidate": {
|
|
227
386
|
"types": "./out/build-candidate.d.ts",
|
|
228
387
|
"default": "./out/build-candidate.js"
|
|
229
388
|
},
|
|
389
|
+
"./candidate-ancestors-schema": {
|
|
390
|
+
"types": "./out/candidate-ancestors-schema.d.ts",
|
|
391
|
+
"default": "./out/candidate-ancestors-schema.js"
|
|
392
|
+
},
|
|
230
393
|
"./candidate-schema": {
|
|
231
394
|
"types": "./out/candidate-schema.d.ts",
|
|
232
395
|
"default": "./out/candidate-schema.js"
|
|
@@ -254,17 +417,126 @@
|
|
|
254
417
|
"./poi-lookup": {
|
|
255
418
|
"types": "./out/poi-lookup.d.ts",
|
|
256
419
|
"default": "./out/poi-lookup.js"
|
|
420
|
+
},
|
|
421
|
+
"./uprn-schema": {
|
|
422
|
+
"types": "./out/uprn-schema.d.ts",
|
|
423
|
+
"default": "./out/uprn-schema.js"
|
|
424
|
+
},
|
|
425
|
+
"./uprn-lookup": {
|
|
426
|
+
"types": "./out/uprn-lookup.d.ts",
|
|
427
|
+
"default": "./out/uprn-lookup.js"
|
|
428
|
+
},
|
|
429
|
+
"./weights-overlay-linker": {
|
|
430
|
+
"types": "./out/weights-overlay-linker.d.ts",
|
|
431
|
+
"default": "./out/weights-overlay-linker.js"
|
|
432
|
+
},
|
|
433
|
+
"./address-point-interpolation": {
|
|
434
|
+
"types": "./out/address-point-interpolation.d.ts",
|
|
435
|
+
"default": "./out/address-point-interpolation.js"
|
|
436
|
+
},
|
|
437
|
+
"./interpolation": {
|
|
438
|
+
"types": "./out/interpolation.d.ts",
|
|
439
|
+
"default": "./out/interpolation.js"
|
|
440
|
+
},
|
|
441
|
+
"./address-point": {
|
|
442
|
+
"types": "./out/address-point.d.ts",
|
|
443
|
+
"default": "./out/address-point.js"
|
|
444
|
+
},
|
|
445
|
+
"./ancestry": {
|
|
446
|
+
"types": "./out/ancestry.d.ts",
|
|
447
|
+
"default": "./out/ancestry.js"
|
|
448
|
+
},
|
|
449
|
+
"./candidate-lookup": {
|
|
450
|
+
"types": "./out/candidate-lookup.d.ts",
|
|
451
|
+
"default": "./out/candidate-lookup.js"
|
|
452
|
+
},
|
|
453
|
+
"./candidate-importance": {
|
|
454
|
+
"types": "./out/candidate-importance.d.ts",
|
|
455
|
+
"default": "./out/candidate-importance.js"
|
|
456
|
+
},
|
|
457
|
+
"./types": {
|
|
458
|
+
"types": "./out/types.d.ts",
|
|
459
|
+
"default": "./out/types.js"
|
|
460
|
+
},
|
|
461
|
+
"./lookup": {
|
|
462
|
+
"types": "./out/lookup.d.ts",
|
|
463
|
+
"default": "./out/lookup.js"
|
|
464
|
+
},
|
|
465
|
+
"./convention": {
|
|
466
|
+
"types": "./out/convention.d.ts",
|
|
467
|
+
"default": "./out/convention.js"
|
|
468
|
+
},
|
|
469
|
+
"./postal-city-alias-lookup": {
|
|
470
|
+
"types": "./out/postal-city-alias-lookup.d.ts",
|
|
471
|
+
"default": "./out/postal-city-alias-lookup.js"
|
|
472
|
+
},
|
|
473
|
+
"./postal-city-candidate-schema": {
|
|
474
|
+
"types": "./out/postal-city-candidate-schema.d.ts",
|
|
475
|
+
"default": "./out/postal-city-candidate-schema.js"
|
|
476
|
+
},
|
|
477
|
+
"./postcode-point-lookup": {
|
|
478
|
+
"types": "./out/postcode-point-lookup.d.ts",
|
|
479
|
+
"default": "./out/postcode-point-lookup.js"
|
|
480
|
+
},
|
|
481
|
+
"./reverse": {
|
|
482
|
+
"types": "./out/reverse.d.ts",
|
|
483
|
+
"default": "./out/reverse.js"
|
|
484
|
+
},
|
|
485
|
+
"./sharding": {
|
|
486
|
+
"types": "./out/sharding.d.ts",
|
|
487
|
+
"default": "./out/sharding.js"
|
|
488
|
+
},
|
|
489
|
+
"./sqlite-convention-source": {
|
|
490
|
+
"types": "./out/sqlite-convention-source.d.ts",
|
|
491
|
+
"default": "./out/sqlite-convention-source.js"
|
|
492
|
+
},
|
|
493
|
+
"./street-centroid": {
|
|
494
|
+
"types": "./out/street-centroid.d.ts",
|
|
495
|
+
"default": "./out/street-centroid.js"
|
|
496
|
+
},
|
|
497
|
+
"./street-name-lookup": {
|
|
498
|
+
"types": "./out/street-name-lookup.d.ts",
|
|
499
|
+
"default": "./out/street-name-lookup.js"
|
|
500
|
+
},
|
|
501
|
+
"./convention-schema": {
|
|
502
|
+
"types": "./out/convention-schema.d.ts",
|
|
503
|
+
"default": "./out/convention-schema.js"
|
|
504
|
+
},
|
|
505
|
+
"./polygon-schema": {
|
|
506
|
+
"types": "./out/polygon-schema.d.ts",
|
|
507
|
+
"default": "./out/polygon-schema.js"
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
"imports": {
|
|
511
|
+
"#candidate/alias-bags": {
|
|
512
|
+
"types": "./out/candidate/alias-bags.d.ts",
|
|
513
|
+
"default": "./out/candidate/alias-bags.js"
|
|
514
|
+
},
|
|
515
|
+
"#candidate/name-roles": {
|
|
516
|
+
"types": "./out/candidate/name-roles.d.ts",
|
|
517
|
+
"default": "./out/candidate/name-roles.js"
|
|
518
|
+
},
|
|
519
|
+
"#candidate/place-attrs": {
|
|
520
|
+
"types": "./out/candidate/place-attrs.d.ts",
|
|
521
|
+
"default": "./out/candidate/place-attrs.js"
|
|
522
|
+
},
|
|
523
|
+
"#sqlite-utils": {
|
|
524
|
+
"types": "./out/sqlite-utils.d.ts",
|
|
525
|
+
"default": "./out/sqlite-utils.js"
|
|
257
526
|
}
|
|
258
527
|
}
|
|
259
528
|
},
|
|
260
529
|
"dependencies": {
|
|
261
|
-
"@mailwoman/
|
|
262
|
-
"@mailwoman/
|
|
263
|
-
"@mailwoman/
|
|
264
|
-
"@mailwoman/
|
|
530
|
+
"@mailwoman/ancestrie": "9.2.0",
|
|
531
|
+
"@mailwoman/codex": "9.2.0",
|
|
532
|
+
"@mailwoman/core": "9.2.0",
|
|
533
|
+
"@mailwoman/match": "9.2.0",
|
|
534
|
+
"@mailwoman/resolver": "9.2.0",
|
|
535
|
+
"@mailwoman/spatial": "9.2.0",
|
|
265
536
|
"h3-js": "^4.5.0",
|
|
266
537
|
"kysely": "^0.29.4",
|
|
267
538
|
"path-ts": "^2.1.0",
|
|
268
|
-
"spliterator": "^6.
|
|
539
|
+
"spliterator": "^6.2.0",
|
|
540
|
+
"type-fest": "^5.8.0"
|
|
269
541
|
}
|
|
270
542
|
}
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
* ABOVE the place every user means. Referentially the suburb wins by 230x on population. One score
|
|
27
27
|
* cannot serve both readers, which is why there are two.
|
|
28
28
|
*
|
|
29
|
-
* THE LEGACY COLUMN STAYS, AND IS DERIVED. `importance`
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* THE LEGACY COLUMN STAYS, AND IS DERIVED. `importance` is written by {@link blendImportance} — the
|
|
30
|
+
* bounded blend the bare-toponym fame consumer (#28) ranks on. It is the CONFLATION, and nothing new
|
|
31
|
+
* should read it; new code reads the split columns.
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
import type { DatabaseSync } from "node:sqlite"
|
|
@@ -36,6 +36,8 @@ import type { DatabaseSync } from "node:sqlite"
|
|
|
36
36
|
import { referentialFromPopulation } from "@mailwoman/core/resolver"
|
|
37
37
|
import type { Kysely } from "kysely"
|
|
38
38
|
|
|
39
|
+
import { allRows } from "./sqlite-utils.ts"
|
|
40
|
+
|
|
39
41
|
//#region Schema
|
|
40
42
|
|
|
41
43
|
/**
|
|
@@ -55,8 +57,8 @@ export interface PlaceImportanceTable {
|
|
|
55
57
|
*/
|
|
56
58
|
encyclopedic: number | null
|
|
57
59
|
/**
|
|
58
|
-
* DEPRECATED — the pre-split conflation, written
|
|
59
|
-
*
|
|
60
|
+
* DEPRECATED — the pre-split conflation, written by {@link blendImportance} so the bare-toponym fame consumer (#28)
|
|
61
|
+
* keeps one cross-bearer scale. New code reads {@link PlaceImportanceTable.referential} (to rank) or
|
|
60
62
|
* {@link PlaceImportanceTable.encyclopedic} (to display).
|
|
61
63
|
*/
|
|
62
64
|
importance: number
|
|
@@ -115,6 +117,55 @@ export {
|
|
|
115
117
|
|
|
116
118
|
//#endregion
|
|
117
119
|
|
|
120
|
+
//#region The legacy blend
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The most the encyclopedic channel may raise a place's blended importance above its population-anchored referential
|
|
124
|
+
* score.
|
|
125
|
+
*
|
|
126
|
+
* In referential units 0.25 is 3.5 population doublings (the referential curve divides log2 by 14), so an article can
|
|
127
|
+
* promote a place as if it were up to ~11x its recorded population — never more. The bound exists because the two
|
|
128
|
+
* channels' scales CROSS at the article floor: merely having a Wikipedia article scores ~0.25–0.35, which exceeds the
|
|
129
|
+
* referential score of a mid-size town, so an unbounded blend ranks a 136-person village with an article above a
|
|
130
|
+
* 16,026-person town without one.
|
|
131
|
+
*
|
|
132
|
+
* The value is bracketed by two decided contests, measured on the 2026-08-24 staging build:
|
|
133
|
+
*
|
|
134
|
+
* - `> 0.2282`, or bare `Whitby` stops answering Whitby GB (pop 13,130, referential 0.2729, encyclopedic 0.5496) over
|
|
135
|
+
* Whitby CA (pop 128,377, referential 0.5011) — the #28 design case the fame prior exists to serve.
|
|
136
|
+
* - `< 0.2790`, or bare `Tó`/`To` answers Tó PT (pop 136, referential 0.0131, encyclopedic 0.3375) over Tô BF (pop
|
|
137
|
+
* 16,026, no article) — the `bf-gloss-to-*` board pair.
|
|
138
|
+
*
|
|
139
|
+
* 0.25 sits mid-interval with ~0.02 margin to each bound.
|
|
140
|
+
*/
|
|
141
|
+
export const ENCYCLOPEDIC_BOOST_CAP = 0.25
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The legacy `importance` blend — one cross-bearer fame scale for the #28 consumer, derived from the two split
|
|
145
|
+
* channels:
|
|
146
|
+
*
|
|
147
|
+
* - No article → the referential score.
|
|
148
|
+
* - No population evidence (`referential` 0) → the encyclopedic score stands alone: there is nothing to bound the
|
|
149
|
+
* article's claim against, and a constant cap would demote every famous place WOF records no population for
|
|
150
|
+
* (meaning-of-zero: referential 0 is "unmeasured", not "tiny").
|
|
151
|
+
* - Both present → the encyclopedic value clamped to at most {@link ENCYCLOPEDIC_BOOST_CAP} above the referential score,
|
|
152
|
+
* and never below it. The floor half repairs the downward inversion (the Seine-Saint-Denis suburb's weak article
|
|
153
|
+
* scored 0.1173 and REPLACED its referential 0.4716 under the old `COALESCE`, so a 418-person Aude hamlet outranked
|
|
154
|
+
* it 4.8x); the cap half repairs the upward one (`Tó`, above).
|
|
155
|
+
*
|
|
156
|
+
* Scale of the clamp on the 2026-08-24 staging build: of 628,202 article-bearing rows, 209,738 sit above the cap and
|
|
157
|
+
* 13,888 sit below their referential floor; the 305,168 article-without-population rows pass through unchanged.
|
|
158
|
+
*/
|
|
159
|
+
export function blendImportance(referential: number, encyclopedic: number | null | undefined): number {
|
|
160
|
+
if (encyclopedic === null || encyclopedic === undefined) return referential
|
|
161
|
+
|
|
162
|
+
if (referential <= 0) return encyclopedic
|
|
163
|
+
|
|
164
|
+
return Math.max(referential, Math.min(encyclopedic, referential + ENCYCLOPEDIC_BOOST_CAP))
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
//#endregion
|
|
168
|
+
|
|
118
169
|
//#region Reading a database that may or may not carry the split
|
|
119
170
|
|
|
120
171
|
/**
|
|
@@ -163,9 +214,7 @@ export function encyclopedicClauses(db: DatabaseSync, schemaName: string): { sel
|
|
|
163
214
|
let present: boolean
|
|
164
215
|
|
|
165
216
|
try {
|
|
166
|
-
const rows = db.prepare(`PRAGMA ${schemaName}.table_info(place_importance)`)
|
|
167
|
-
name: string
|
|
168
|
-
}>
|
|
217
|
+
const rows = allRows<{ name: string }>(db.prepare(`PRAGMA ${schemaName}.table_info(place_importance)`))
|
|
169
218
|
|
|
170
219
|
present = rows.some((r) => r.name === "encyclopedic")
|
|
171
220
|
} catch {
|
|
@@ -253,7 +302,7 @@ export interface ImportanceSplit {
|
|
|
253
302
|
*/
|
|
254
303
|
function tableColumns(db: DatabaseSync, table: string): Set<string> {
|
|
255
304
|
try {
|
|
256
|
-
const rows = db.prepare(`PRAGMA table_info(${table})`)
|
|
305
|
+
const rows = allRows<{ name: string }>(db.prepare(`PRAGMA table_info(${table})`))
|
|
257
306
|
|
|
258
307
|
return new Set(rows.map((r) => r.name))
|
|
259
308
|
} catch {
|
|
@@ -276,10 +325,10 @@ export function loadImportanceSplit(db: DatabaseSync): ImportanceSplit {
|
|
|
276
325
|
const populationColumns = tableColumns(db, "place_population")
|
|
277
326
|
|
|
278
327
|
if (populationColumns.has("population")) {
|
|
279
|
-
const rows =
|
|
328
|
+
const rows = allRows<{
|
|
280
329
|
id: number
|
|
281
330
|
population: number
|
|
282
|
-
}>
|
|
331
|
+
}>(db.prepare("SELECT id, population FROM place_population"))
|
|
283
332
|
|
|
284
333
|
for (const row of rows) {
|
|
285
334
|
population.set(row.id, row.population)
|
|
@@ -297,11 +346,11 @@ export function loadImportanceSplit(db: DatabaseSync): ImportanceSplit {
|
|
|
297
346
|
// Post-split build: the columns ARE the contract. Referential is read verbatim rather than
|
|
298
347
|
// re-derived, so a build that scored referential differently stays visible instead of being
|
|
299
348
|
// silently overwritten by this reader's own formula.
|
|
300
|
-
const rows =
|
|
349
|
+
const rows = allRows<{
|
|
301
350
|
id: number
|
|
302
351
|
referential: number
|
|
303
352
|
encyclopedic: number | null
|
|
304
|
-
}>
|
|
353
|
+
}>(db.prepare("SELECT id, referential, encyclopedic FROM place_importance"))
|
|
305
354
|
|
|
306
355
|
for (const row of rows) {
|
|
307
356
|
if (row.referential > 0) {
|
|
@@ -317,10 +366,10 @@ export function loadImportanceSplit(db: DatabaseSync): ImportanceSplit {
|
|
|
317
366
|
}
|
|
318
367
|
|
|
319
368
|
if (importanceColumns.has("importance")) {
|
|
320
|
-
const rows =
|
|
369
|
+
const rows = allRows<{
|
|
321
370
|
id: number
|
|
322
371
|
importance: number
|
|
323
|
-
}>
|
|
372
|
+
}>(db.prepare("SELECT id, importance FROM place_importance"))
|
|
324
373
|
|
|
325
374
|
let legacyFallbackRows = 0
|
|
326
375
|
|
package/poi-lookup.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { haversineKm, shortCellToInt, type H3Cell } from "@mailwoman/spatial"
|
|
|
31
31
|
import { gridDisk, latLngToCell } from "h3-js"
|
|
32
32
|
|
|
33
33
|
import type { POICategoryCodeTable, POITable } from "./poi-schema.ts"
|
|
34
|
+
import { allRows } from "./sqlite-utils.ts"
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
37
|
* Resolution the `poi` table's `h3_cell` column is keyed at — matches the builder (spec §3.4).
|
|
@@ -141,7 +142,7 @@ type POIRow = Pick<
|
|
|
141
142
|
/**
|
|
142
143
|
* Node reader over `poi.db`. `implements Disposable` so callers can `using lookup = new POILookup(...)` (or call
|
|
143
144
|
* `[Symbol.dispose]()` explicitly), the same precedent as {@link WOFCandidateTableLookup} /
|
|
144
|
-
* {@link
|
|
145
|
+
* {@link WOFSQLitePlaceLookup}.
|
|
145
146
|
*/
|
|
146
147
|
export class POILookup implements Disposable {
|
|
147
148
|
#db: DatabaseSync
|
|
@@ -175,9 +176,7 @@ export class POILookup implements Disposable {
|
|
|
175
176
|
|
|
176
177
|
// The category dictionary is tiny (poi-taxonomy's category count) — load it once at
|
|
177
178
|
// construction so `search` never round-trips to it.
|
|
178
|
-
for (const r of this.#db
|
|
179
|
-
.prepare("SELECT id, category FROM poi_category_codes")
|
|
180
|
-
.all() as unknown as POICategoryCodeTable[]) {
|
|
179
|
+
for (const r of allRows<POICategoryCodeTable>(this.#db.prepare("SELECT id, category FROM poi_category_codes"))) {
|
|
181
180
|
this.#categoryToID.set(String(r.category), Number(r.id))
|
|
182
181
|
this.#idToCategory.set(Number(r.id), String(r.category))
|
|
183
182
|
}
|
|
@@ -226,7 +225,7 @@ export class POILookup implements Disposable {
|
|
|
226
225
|
* nearest at any distance — the reach ceiling k-ring hits on sparse brand rows is gone.
|
|
227
226
|
*/
|
|
228
227
|
#searchBrand(brandWikidata: string, center: { latitude: number; longitude: number }, limit: number): POISearchHit[] {
|
|
229
|
-
const rows = this.#brandProbe
|
|
228
|
+
const rows = allRows<POIRow>(this.#brandProbe, brandWikidata)
|
|
230
229
|
|
|
231
230
|
return sortByDistance(rows, center)
|
|
232
231
|
.filter(
|
|
@@ -242,7 +241,7 @@ export class POILookup implements Disposable {
|
|
|
242
241
|
#searchKRing(query: POISearchQuery, limit: number): POISearchHit[] {
|
|
243
242
|
const center = query.center!
|
|
244
243
|
const maxRings = query.maxRings ?? DEFAULT_MAX_RINGS
|
|
245
|
-
const
|
|
244
|
+
const categoryIDs: number[] = []
|
|
246
245
|
|
|
247
246
|
// `categoryIDs` (the fan-out list) supersedes the single `categoryID`; either way, resolve each id through the
|
|
248
247
|
// dictionary and drop the ones the db doesn't carry (Overture-taxonomy drift, or an identity id with no rows).
|
|
@@ -252,12 +251,12 @@ export class POILookup implements Disposable {
|
|
|
252
251
|
const resolved = this.#categoryToID.get(id)
|
|
253
252
|
|
|
254
253
|
if (resolved !== undefined) {
|
|
255
|
-
|
|
254
|
+
categoryIDs.push(resolved)
|
|
256
255
|
}
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
// No resolvable leaf (every id unknown to the dictionary) can't have rows — a clean miss, not a throw.
|
|
260
|
-
if (!
|
|
259
|
+
if (!categoryIDs.length) return []
|
|
261
260
|
|
|
262
261
|
const origin = latLngToCell(center.latitude, center.longitude, POI_H3_RESOLUTION) as H3Cell
|
|
263
262
|
const seenCells = new Set<string>()
|
|
@@ -276,8 +275,8 @@ export class POILookup implements Disposable {
|
|
|
276
275
|
|
|
277
276
|
// Fan-out: probe every resolved Overture leaf for this canonical category, unioning the rows. The
|
|
278
277
|
// post-ring distance sort + `slice(0, limit)` below dedupes the pool down to the nearest `limit`.
|
|
279
|
-
for (const categoryID of
|
|
280
|
-
rows.push(...(this.#categoryCellProbe
|
|
278
|
+
for (const categoryID of categoryIDs) {
|
|
279
|
+
rows.push(...allRows<POIRow>(this.#categoryCellProbe, shortCell, categoryID, limit))
|
|
281
280
|
}
|
|
282
281
|
}
|
|
283
282
|
|
|
@@ -301,7 +300,7 @@ export class POILookup implements Disposable {
|
|
|
301
300
|
|
|
302
301
|
if (!matchQuery) return []
|
|
303
302
|
|
|
304
|
-
const ftsHits =
|
|
303
|
+
const ftsHits = allRows<{ name_key: string | null }>(this.#nameFTSProbe, matchQuery, limit)
|
|
305
304
|
const uniqueKeys: string[] = []
|
|
306
305
|
const seenKeys = new Set<string>()
|
|
307
306
|
|
|
@@ -350,7 +349,7 @@ export class POILookup implements Disposable {
|
|
|
350
349
|
const placeholders = nameKeys.map(() => "?").join(", ")
|
|
351
350
|
const stmt = this.#db.prepare(`SELECT ${columns} FROM poi WHERE name_key IN (${placeholders})`)
|
|
352
351
|
|
|
353
|
-
return stmt
|
|
352
|
+
return allRows<POIRow>(stmt, ...nameKeys)
|
|
354
353
|
}
|
|
355
354
|
|
|
356
355
|
close(): void {
|
|
@@ -406,7 +405,7 @@ function sanitizePOINameQuery(text: string): string {
|
|
|
406
405
|
.replaceAll(/["*:]/g, "")
|
|
407
406
|
.trim()
|
|
408
407
|
.split(/\s+/u)
|
|
409
|
-
.filter(
|
|
408
|
+
.filter((token) => token.length > 0)
|
|
410
409
|
.map((token) => `"${token.replaceAll('"', '""')}"`)
|
|
411
410
|
.join(" ")
|
|
412
411
|
}
|
package/poi-schema.ts
CHANGED
|
@@ -17,6 +17,8 @@ import type { DatabaseSync } from "node:sqlite"
|
|
|
17
17
|
import type { LayerContractDatabase } from "@mailwoman/core/layers"
|
|
18
18
|
import { sql, type Kysely } from "kysely"
|
|
19
19
|
|
|
20
|
+
import type { NameKey } from "./street-normalize.ts"
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
* One POI row. Clustered PK: h3_cell → category_id → neg_rank → rowid_key.
|
|
22
24
|
*/
|
|
@@ -39,9 +41,12 @@ export interface POITable {
|
|
|
39
41
|
rowid_key: number
|
|
40
42
|
name: string | null
|
|
41
43
|
/**
|
|
42
|
-
*
|
|
44
|
+
* Probe key for exact name lookups, minted by {@link normalizeLocalityForKey} at build AND at query.
|
|
45
|
+
*
|
|
46
|
+
* Branded because a `toLowerCase()` approximation of the fold is still a `string`: it binds to the parameter, returns
|
|
47
|
+
* fewer rows, and the shortfall reads as a coverage gap in the data rather than a defect in the probe.
|
|
43
48
|
*/
|
|
44
|
-
name_key:
|
|
49
|
+
name_key: NameKey | null
|
|
45
50
|
brand_wikidata: string | null
|
|
46
51
|
latitude: number
|
|
47
52
|
longitude: number
|
|
@@ -69,7 +74,7 @@ export interface POIStageTable {
|
|
|
69
74
|
neg_rank: number | null
|
|
70
75
|
rowid_key: number | null
|
|
71
76
|
name: string | null
|
|
72
|
-
name_key:
|
|
77
|
+
name_key: NameKey | null
|
|
73
78
|
brand_wikidata: string | null
|
|
74
79
|
latitude: number
|
|
75
80
|
longitude: number
|