@mailwoman/resolver-wof-sqlite 10.0.0 → 10.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 +9 -8
- package/lib/address/point/interpolation.ts +45 -39
- package/lib/address/point/schema.ts +17 -40
- package/lib/address/point.ts +316 -0
- package/lib/{address/index.ts → address.ts} +1 -1
- package/lib/ancestry/backfill.ts +20 -86
- package/lib/{ancestry/index.ts → ancestry.ts} +19 -15
- package/lib/build/candidate.ts +122 -174
- package/lib/build/population-corrections.ts +64 -0
- package/lib/build/slim.ts +44 -114
- package/lib/candidate/alias-bags.ts +16 -17
- package/lib/candidate/ancestors/schema.ts +77 -61
- package/lib/candidate/ancestors/sidecar.ts +15 -22
- package/lib/candidate/country-display-names.ts +6 -20
- package/lib/candidate/extract-fold.ts +10 -55
- package/lib/candidate/fts.ts +5 -23
- package/lib/candidate/importance.ts +65 -68
- package/lib/candidate/lookup.ts +124 -415
- package/lib/candidate/name-roles.ts +15 -33
- package/lib/candidate/own-name.ts +35 -32
- package/lib/candidate/place-attrs.ts +20 -13
- package/lib/candidate/schema.ts +29 -65
- package/lib/candidate/scoring.ts +54 -93
- package/lib/capital-schema.ts +21 -17
- package/lib/capitals.ts +29 -27
- package/lib/coincident-roles.ts +85 -55
- package/lib/convention/schema.ts +15 -16
- package/lib/convention.ts +144 -0
- package/lib/coverage-manifest-schema.ts +40 -45
- package/lib/currency-backfill.ts +34 -79
- package/lib/env.ts +1 -1
- package/lib/exact-match.ts +32 -21
- package/lib/extracts.ts +97 -74
- package/lib/fst/autocomplete.ts +54 -37
- package/lib/fst/builder.ts +37 -41
- package/lib/fst/deserialize-web.ts +16 -17
- package/lib/fst/format.ts +41 -23
- package/lib/fst/freshness.ts +43 -120
- package/lib/fst/matcher.ts +7 -5
- package/lib/fst/serialize.ts +54 -74
- package/lib/fst/types.ts +78 -75
- package/lib/{fst/index.ts → fst.ts} +1 -0
- package/lib/fts/query.ts +5 -36
- package/lib/fts.ts +280 -0
- package/lib/geonames/aliases.ts +73 -144
- package/lib/geonames/postal.ts +162 -71
- package/lib/index.ts +9 -8
- package/lib/interpolation.ts +48 -100
- package/lib/lookup.ts +155 -270
- package/lib/name-score.ts +9 -7
- package/lib/nsul/lookup.ts +37 -54
- package/lib/nsul/schema.ts +16 -43
- package/lib/paths.ts +159 -0
- package/lib/place-importance-schema.ts +62 -169
- package/lib/poi/lookup.ts +104 -121
- package/lib/poi/schema.ts +42 -26
- package/lib/polygon-schema.ts +10 -6
- package/lib/postal/city/alias/lookup.ts +22 -40
- package/lib/postal/city/alias/schema.ts +14 -10
- package/lib/postal/city/candidate-schema.ts +26 -20
- package/lib/postcode-point-lookup.ts +8 -27
- package/lib/primary-preference.ts +46 -126
- package/lib/proximity-rerank.ts +44 -33
- package/lib/ranking-weights.ts +105 -78
- package/lib/region-keys.ts +70 -42
- package/lib/reverse.ts +149 -86
- package/lib/schema.ts +73 -50
- package/lib/search-fetch.ts +90 -68
- package/lib/sqlite/convention-source.ts +15 -23
- package/lib/sqlite/utils.ts +19 -22
- package/lib/street/centroid/schema.ts +37 -42
- package/lib/street/{centroid/index.ts → centroid.ts} +16 -25
- package/lib/street/morphology/fst/builder.ts +60 -42
- package/lib/street/morphology/fst/loader.ts +40 -32
- package/lib/street/name-lookup.ts +45 -41
- package/lib/street/normalize.ts +88 -219
- package/lib/street/segment-schema.ts +116 -43
- package/lib/{street/index.ts → street.ts} +1 -1
- package/lib/types.ts +109 -150
- package/lib/unified-schema.ts +29 -29
- package/lib/uprn/existence.ts +30 -19
- package/lib/uprn/lookup.ts +29 -68
- package/lib/uprn/schema.ts +18 -40
- package/lib/weights-overlay-linker.ts +236 -252
- package/out/address/point/interpolation.d.ts +20 -23
- package/out/address/point/interpolation.d.ts.map +1 -1
- package/out/address/point/interpolation.js +42 -39
- package/out/address/point/interpolation.js.map +1 -1
- package/out/address/point/schema.d.ts +12 -35
- package/out/address/point/schema.d.ts.map +1 -1
- package/out/address/point/schema.js +3 -19
- package/out/address/point/schema.js.map +1 -1
- package/out/address/point.d.ts +57 -0
- package/out/address/point.d.ts.map +1 -0
- package/out/address/point.js +206 -0
- package/out/address/point.js.map +1 -0
- package/out/{address/index.js → address.d.ts} +2 -2
- package/out/address.d.ts.map +1 -0
- package/out/{address/index.d.ts → address.js} +2 -2
- package/out/address.js.map +1 -0
- package/out/ancestry/backfill.d.ts +11 -64
- package/out/ancestry/backfill.d.ts.map +1 -1
- package/out/ancestry/backfill.js +14 -74
- package/out/ancestry/backfill.js.map +1 -1
- package/out/ancestry.d.ts +49 -0
- package/out/ancestry.d.ts.map +1 -0
- package/out/ancestry.js +59 -0
- package/out/ancestry.js.map +1 -0
- package/out/build/candidate.d.ts +82 -112
- package/out/build/candidate.d.ts.map +1 -1
- package/out/build/candidate.js +17 -100
- package/out/build/candidate.js.map +1 -1
- package/out/build/population-corrections.d.ts +52 -0
- package/out/build/population-corrections.d.ts.map +1 -0
- package/out/build/population-corrections.js +40 -0
- package/out/build/population-corrections.js.map +1 -0
- package/out/build/slim.d.ts +8 -44
- package/out/build/slim.d.ts.map +1 -1
- package/out/build/slim.js +33 -94
- package/out/build/slim.js.map +1 -1
- package/out/candidate/alias-bags.d.ts +6 -6
- package/out/candidate/alias-bags.d.ts.map +1 -1
- package/out/candidate/alias-bags.js +16 -17
- package/out/candidate/alias-bags.js.map +1 -1
- package/out/candidate/ancestors/schema.d.ts +73 -57
- package/out/candidate/ancestors/schema.d.ts.map +1 -1
- package/out/candidate/ancestors/schema.js +56 -48
- package/out/candidate/ancestors/schema.js.map +1 -1
- package/out/candidate/ancestors/sidecar.d.ts +3 -8
- package/out/candidate/ancestors/sidecar.d.ts.map +1 -1
- package/out/candidate/ancestors/sidecar.js +15 -22
- package/out/candidate/ancestors/sidecar.js.map +1 -1
- package/out/candidate/country-display-names.d.ts +5 -15
- package/out/candidate/country-display-names.d.ts.map +1 -1
- package/out/candidate/country-display-names.js +6 -20
- package/out/candidate/country-display-names.js.map +1 -1
- package/out/candidate/extract-fold.d.ts +7 -15
- package/out/candidate/extract-fold.d.ts.map +1 -1
- package/out/candidate/extract-fold.js +5 -47
- package/out/candidate/extract-fold.js.map +1 -1
- package/out/candidate/fts.d.ts +5 -23
- package/out/candidate/fts.d.ts.map +1 -1
- package/out/candidate/fts.js +5 -23
- package/out/candidate/fts.js.map +1 -1
- package/out/candidate/importance.d.ts +60 -65
- package/out/candidate/importance.d.ts.map +1 -1
- package/out/candidate/importance.js +56 -63
- package/out/candidate/importance.js.map +1 -1
- package/out/candidate/lookup.d.ts +18 -55
- package/out/candidate/lookup.d.ts.map +1 -1
- package/out/candidate/lookup.js +82 -385
- package/out/candidate/lookup.js.map +1 -1
- package/out/candidate/name-roles.d.ts +9 -21
- package/out/candidate/name-roles.d.ts.map +1 -1
- package/out/candidate/name-roles.js +15 -33
- package/out/candidate/name-roles.js.map +1 -1
- package/out/candidate/own-name.d.ts +23 -25
- package/out/candidate/own-name.d.ts.map +1 -1
- package/out/candidate/own-name.js +35 -32
- package/out/candidate/own-name.js.map +1 -1
- package/out/candidate/place-attrs.d.ts +20 -13
- package/out/candidate/place-attrs.d.ts.map +1 -1
- package/out/candidate/place-attrs.js +4 -5
- package/out/candidate/place-attrs.js.map +1 -1
- package/out/candidate/schema.d.ts +27 -62
- package/out/candidate/schema.d.ts.map +1 -1
- package/out/candidate/schema.js +10 -22
- package/out/candidate/schema.js.map +1 -1
- package/out/candidate/scoring.d.ts +7 -8
- package/out/candidate/scoring.d.ts.map +1 -1
- package/out/candidate/scoring.js +52 -89
- package/out/candidate/scoring.js.map +1 -1
- package/out/capital-schema.d.ts +21 -17
- package/out/capital-schema.d.ts.map +1 -1
- package/out/capital-schema.js +17 -15
- package/out/capital-schema.js.map +1 -1
- package/out/capitals.d.ts +27 -25
- package/out/capitals.d.ts.map +1 -1
- package/out/capitals.js +23 -21
- package/out/capitals.js.map +1 -1
- package/out/coincident-roles.d.ts +60 -43
- package/out/coincident-roles.d.ts.map +1 -1
- package/out/coincident-roles.js +72 -50
- package/out/coincident-roles.js.map +1 -1
- package/out/convention/schema.d.ts +14 -14
- package/out/convention/schema.d.ts.map +1 -1
- package/out/convention/schema.js +6 -4
- package/out/convention/schema.js.map +1 -1
- package/out/convention.d.ts +97 -0
- package/out/convention.d.ts.map +1 -0
- package/out/convention.js +81 -0
- package/out/convention.js.map +1 -0
- package/out/coverage-manifest-schema.d.ts +34 -39
- package/out/coverage-manifest-schema.d.ts.map +1 -1
- package/out/coverage-manifest-schema.js +25 -34
- package/out/coverage-manifest-schema.js.map +1 -1
- package/out/currency-backfill.d.ts +16 -38
- package/out/currency-backfill.d.ts.map +1 -1
- package/out/currency-backfill.js +19 -46
- package/out/currency-backfill.js.map +1 -1
- package/out/env.d.ts +1 -1
- package/out/env.js +1 -1
- package/out/exact-match.d.ts +19 -10
- package/out/exact-match.d.ts.map +1 -1
- package/out/exact-match.js +32 -21
- package/out/exact-match.js.map +1 -1
- package/out/extracts.d.ts +66 -55
- package/out/extracts.d.ts.map +1 -1
- package/out/extracts.js +63 -55
- package/out/extracts.js.map +1 -1
- package/out/fst/autocomplete.d.ts +29 -21
- package/out/fst/autocomplete.d.ts.map +1 -1
- package/out/fst/autocomplete.js +39 -28
- package/out/fst/autocomplete.js.map +1 -1
- package/out/fst/builder.d.ts.map +1 -1
- package/out/fst/builder.js +37 -41
- package/out/fst/builder.js.map +1 -1
- package/out/fst/deserialize-web.d.ts +4 -4
- package/out/fst/deserialize-web.d.ts.map +1 -1
- package/out/fst/deserialize-web.js +15 -16
- package/out/fst/deserialize-web.js.map +1 -1
- package/out/fst/format.d.ts +41 -23
- package/out/fst/format.d.ts.map +1 -1
- package/out/fst/format.js +41 -23
- package/out/fst/format.js.map +1 -1
- package/out/fst/freshness.d.ts +19 -81
- package/out/fst/freshness.d.ts.map +1 -1
- package/out/fst/freshness.js +31 -94
- package/out/fst/freshness.js.map +1 -1
- package/out/fst/matcher.d.ts +5 -4
- package/out/fst/matcher.d.ts.map +1 -1
- package/out/fst/matcher.js +2 -2
- package/out/fst/matcher.js.map +1 -1
- package/out/fst/serialize.d.ts +28 -28
- package/out/fst/serialize.d.ts.map +1 -1
- package/out/fst/serialize.js +53 -71
- package/out/fst/serialize.js.map +1 -1
- package/out/fst/types.d.ts +78 -74
- package/out/fst/types.d.ts.map +1 -1
- package/out/fst/types.js +1 -4
- package/out/fst/types.js.map +1 -1
- package/out/{fst/index.js → fst.d.ts} +2 -1
- package/out/fst.d.ts.map +1 -0
- package/out/{fst/index.d.ts → fst.js} +2 -1
- package/out/fst.js.map +1 -0
- package/out/fts/query.d.ts +2 -27
- package/out/fts/query.d.ts.map +1 -1
- package/out/fts/query.js +5 -36
- package/out/fts/query.js.map +1 -1
- package/out/fts.d.ts +126 -0
- package/out/fts.d.ts.map +1 -0
- package/out/fts.js +188 -0
- package/out/fts.js.map +1 -0
- package/out/geonames/aliases.d.ts +26 -62
- package/out/geonames/aliases.d.ts.map +1 -1
- package/out/geonames/aliases.js +45 -117
- package/out/geonames/aliases.js.map +1 -1
- package/out/geonames/postal.d.ts +84 -44
- package/out/geonames/postal.d.ts.map +1 -1
- package/out/geonames/postal.js +115 -73
- package/out/geonames/postal.js.map +1 -1
- package/out/{geonames/index.js → geonames.d.ts} +1 -1
- package/out/geonames.d.ts.map +1 -0
- package/out/{geonames/index.d.ts → geonames.js} +1 -1
- package/out/geonames.js.map +1 -0
- package/out/index.d.ts +9 -8
- package/out/index.d.ts.map +1 -1
- package/out/index.js +6 -5
- package/out/index.js.map +1 -1
- package/out/interpolation.d.ts +18 -55
- package/out/interpolation.d.ts.map +1 -1
- package/out/interpolation.js +27 -69
- package/out/interpolation.js.map +1 -1
- package/out/lookup.d.ts +23 -51
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +136 -234
- package/out/lookup.js.map +1 -1
- package/out/name-score.d.ts +2 -2
- package/out/name-score.d.ts.map +1 -1
- package/out/name-score.js +9 -7
- package/out/name-score.js.map +1 -1
- package/out/nsul/lookup.d.ts +33 -34
- package/out/nsul/lookup.d.ts.map +1 -1
- package/out/nsul/lookup.js +26 -40
- package/out/nsul/lookup.js.map +1 -1
- package/out/nsul/schema.d.ts +16 -43
- package/out/nsul/schema.d.ts.map +1 -1
- package/out/nsul/schema.js +9 -35
- package/out/nsul/schema.js.map +1 -1
- package/out/{nsul/index.d.ts → nsul.d.ts} +1 -1
- package/out/nsul.d.ts.map +1 -0
- package/out/{nsul/index.js → nsul.js} +1 -1
- package/out/nsul.js.map +1 -0
- package/out/paths.d.ts +124 -0
- package/out/paths.d.ts.map +1 -0
- package/out/paths.js +104 -0
- package/out/paths.js.map +1 -0
- package/out/place-importance-schema.d.ts +51 -143
- package/out/place-importance-schema.d.ts.map +1 -1
- package/out/place-importance-schema.js +28 -143
- package/out/place-importance-schema.js.map +1 -1
- package/out/poi/lookup.d.ts +40 -47
- package/out/poi/lookup.d.ts.map +1 -1
- package/out/poi/lookup.js +69 -96
- package/out/poi/lookup.js.map +1 -1
- package/out/poi/schema.d.ts +41 -25
- package/out/poi/schema.d.ts.map +1 -1
- package/out/poi/schema.js +25 -17
- package/out/poi/schema.js.map +1 -1
- package/out/{poi/index.js → poi.d.ts} +1 -1
- package/out/poi.d.ts.map +1 -0
- package/out/{poi/index.d.ts → poi.js} +1 -1
- package/out/poi.js.map +1 -0
- package/out/polygon-schema.d.ts +10 -6
- package/out/polygon-schema.d.ts.map +1 -1
- package/out/polygon-schema.js +2 -2
- package/out/polygon-schema.js.map +1 -1
- package/out/postal/city/alias/lookup.d.ts +20 -23
- package/out/postal/city/alias/lookup.d.ts.map +1 -1
- package/out/postal/city/alias/lookup.js +17 -30
- package/out/postal/city/alias/lookup.js.map +1 -1
- package/out/postal/city/alias/schema.d.ts +14 -10
- package/out/postal/city/alias/schema.d.ts.map +1 -1
- package/out/postal/city/alias/schema.js +10 -8
- package/out/postal/city/alias/schema.js.map +1 -1
- package/out/postal/city/candidate-schema.d.ts +25 -19
- package/out/postal/city/candidate-schema.d.ts.map +1 -1
- package/out/postal/city/candidate-schema.js +21 -17
- package/out/postal/city/candidate-schema.js.map +1 -1
- package/out/{postal/index.d.ts → postal.d.ts} +1 -1
- package/out/postal.d.ts.map +1 -0
- package/out/{postal/index.js → postal.js} +1 -1
- package/out/postal.js.map +1 -0
- package/out/postcode-point-lookup.d.ts +6 -24
- package/out/postcode-point-lookup.d.ts.map +1 -1
- package/out/postcode-point-lookup.js +5 -17
- package/out/postcode-point-lookup.js.map +1 -1
- package/out/primary-preference.d.ts +38 -92
- package/out/primary-preference.d.ts.map +1 -1
- package/out/primary-preference.js +15 -99
- package/out/primary-preference.js.map +1 -1
- package/out/proximity-rerank.d.ts +41 -30
- package/out/proximity-rerank.d.ts.map +1 -1
- package/out/proximity-rerank.js +38 -29
- package/out/proximity-rerank.js.map +1 -1
- package/out/ranking-weights.d.ts +98 -64
- package/out/ranking-weights.d.ts.map +1 -1
- package/out/ranking-weights.js +26 -25
- package/out/ranking-weights.js.map +1 -1
- package/out/region-keys.d.ts +50 -31
- package/out/region-keys.d.ts.map +1 -1
- package/out/region-keys.js +68 -40
- package/out/region-keys.js.map +1 -1
- package/out/reverse.d.ts +78 -50
- package/out/reverse.d.ts.map +1 -1
- package/out/reverse.js +98 -61
- package/out/reverse.js.map +1 -1
- package/out/schema.d.ts +72 -49
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +4 -5
- package/out/schema.js.map +1 -1
- package/out/search-fetch.d.ts +16 -12
- package/out/search-fetch.d.ts.map +1 -1
- package/out/search-fetch.js +83 -63
- package/out/search-fetch.js.map +1 -1
- package/out/sqlite/convention-source.d.ts +12 -16
- package/out/sqlite/convention-source.d.ts.map +1 -1
- package/out/sqlite/convention-source.js +13 -22
- package/out/sqlite/convention-source.js.map +1 -1
- package/out/sqlite/utils.d.ts +19 -19
- package/out/sqlite/utils.d.ts.map +1 -1
- package/out/sqlite/utils.js +14 -15
- package/out/sqlite/utils.js.map +1 -1
- package/out/street/centroid/schema.d.ts +37 -42
- package/out/street/centroid/schema.d.ts.map +1 -1
- package/out/street/centroid/schema.js +9 -21
- package/out/street/centroid/schema.js.map +1 -1
- package/out/street/centroid.d.ts +30 -0
- package/out/street/centroid.d.ts.map +1 -0
- package/out/street/{centroid/index.js → centroid.js} +13 -24
- package/out/street/centroid.js.map +1 -0
- package/out/street/morphology/fst/builder.d.ts +20 -10
- package/out/street/morphology/fst/builder.d.ts.map +1 -1
- package/out/street/morphology/fst/builder.js +44 -34
- package/out/street/morphology/fst/builder.js.map +1 -1
- package/out/street/morphology/fst/loader.d.ts +33 -26
- package/out/street/morphology/fst/loader.d.ts.map +1 -1
- package/out/street/morphology/fst/loader.js +23 -22
- package/out/street/morphology/fst/loader.js.map +1 -1
- package/out/street/name-lookup.d.ts +24 -18
- package/out/street/name-lookup.d.ts.map +1 -1
- package/out/street/name-lookup.js +34 -35
- package/out/street/name-lookup.js.map +1 -1
- package/out/street/normalize.d.ts +35 -136
- package/out/street/normalize.d.ts.map +1 -1
- package/out/street/normalize.js +77 -194
- package/out/street/normalize.js.map +1 -1
- package/out/street/segment-schema.d.ts +79 -39
- package/out/street/segment-schema.d.ts.map +1 -1
- package/out/street/segment-schema.js +71 -21
- package/out/street/segment-schema.js.map +1 -1
- package/out/{street/index.js → street.d.ts} +2 -2
- package/out/street.d.ts.map +1 -0
- package/out/{street/index.d.ts → street.js} +2 -2
- package/out/street.js.map +1 -0
- package/out/types.d.ts +84 -149
- package/out/types.d.ts.map +1 -1
- package/out/types.js +0 -6
- package/out/types.js.map +1 -1
- package/out/unified-schema.d.ts +8 -12
- package/out/unified-schema.d.ts.map +1 -1
- package/out/unified-schema.js +29 -29
- package/out/unified-schema.js.map +1 -1
- package/out/uprn/existence.d.ts +28 -17
- package/out/uprn/existence.d.ts.map +1 -1
- package/out/uprn/existence.js +26 -16
- package/out/uprn/existence.js.map +1 -1
- package/out/uprn/lookup.d.ts +14 -44
- package/out/uprn/lookup.d.ts.map +1 -1
- package/out/uprn/lookup.js +21 -57
- package/out/uprn/lookup.js.map +1 -1
- package/out/uprn/schema.d.ts +18 -40
- package/out/uprn/schema.d.ts.map +1 -1
- package/out/uprn/schema.js +10 -32
- package/out/uprn/schema.js.map +1 -1
- package/out/{uprn/index.d.ts → uprn.d.ts} +1 -1
- package/out/uprn.d.ts.map +1 -0
- package/out/{uprn/index.js → uprn.js} +1 -1
- package/out/uprn.js.map +1 -0
- package/out/weights-overlay-linker.d.ts +138 -144
- package/out/weights-overlay-linker.d.ts.map +1 -1
- package/out/weights-overlay-linker.js +105 -159
- package/out/weights-overlay-linker.js.map +1 -1
- package/package.json +91 -596
- package/lib/address/point/index.ts +0 -328
- package/lib/convention/index.ts +0 -154
- package/lib/fts/index.ts +0 -361
- package/out/address/index.d.ts.map +0 -1
- package/out/address/index.js.map +0 -1
- package/out/address/point/index.d.ts +0 -53
- package/out/address/point/index.d.ts.map +0 -1
- package/out/address/point/index.js +0 -222
- package/out/address/point/index.js.map +0 -1
- package/out/ancestry/index.d.ts +0 -45
- package/out/ancestry/index.d.ts.map +0 -1
- package/out/ancestry/index.js +0 -55
- package/out/ancestry/index.js.map +0 -1
- package/out/convention/index.d.ts +0 -106
- package/out/convention/index.d.ts.map +0 -1
- package/out/convention/index.js +0 -93
- package/out/convention/index.js.map +0 -1
- package/out/fst/index.d.ts.map +0 -1
- package/out/fst/index.js.map +0 -1
- package/out/fts/index.d.ts +0 -184
- package/out/fts/index.d.ts.map +0 -1
- package/out/fts/index.js +0 -277
- package/out/fts/index.js.map +0 -1
- package/out/geonames/index.d.ts.map +0 -1
- package/out/geonames/index.js.map +0 -1
- package/out/nsul/index.d.ts.map +0 -1
- package/out/nsul/index.js.map +0 -1
- package/out/poi/index.d.ts.map +0 -1
- package/out/poi/index.js.map +0 -1
- package/out/postal/index.d.ts.map +0 -1
- package/out/postal/index.js.map +0 -1
- package/out/street/centroid/index.d.ts +0 -40
- package/out/street/centroid/index.d.ts.map +0 -1
- package/out/street/centroid/index.js.map +0 -1
- package/out/street/index.d.ts.map +0 -1
- package/out/street/index.js.map +0 -1
- package/out/uprn/index.d.ts.map +0 -1
- package/out/uprn/index.js.map +0 -1
- /package/lib/{geonames/index.ts → geonames.ts} +0 -0
- /package/lib/{nsul/index.ts → nsul.ts} +0 -0
- /package/lib/{poi/index.ts → poi.ts} +0 -0
- /package/lib/{postal/index.ts → postal.ts} +0 -0
- /package/lib/{uprn/index.ts → uprn.ts} +0 -0
package/out/schema.d.ts
CHANGED
|
@@ -3,21 +3,23 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Kysely table types for the subset of the Who's On First SQLite schema
|
|
6
|
+
* Kysely table types for the subset of the Who's On First SQLite schema this package touches.
|
|
7
7
|
*
|
|
8
|
-
* The full upstream distribution at data.geocode.earth/wof/dist/sqlite/ ships
|
|
9
|
-
* models only the
|
|
10
|
-
* verified their shapes and they're not part of the resolver's contract.
|
|
8
|
+
* The full upstream distribution at data.geocode.earth/wof/dist/sqlite/ ships about seven tables.
|
|
9
|
+
* This file models only the tables we read. The others are outside the resolver interface. Their shapes remain unverified.
|
|
11
10
|
*
|
|
12
11
|
* Authoritative schema docs:
|
|
13
12
|
*
|
|
14
|
-
* - Whosonfirst SQLite
|
|
13
|
+
* - Whosonfirst SQLite readme: https://github.com/whosonfirst/go-whosonfirst-sqlite
|
|
15
14
|
* - Per-table sources under https://github.com/whosonfirst/go-whosonfirst-sqlite-features
|
|
16
15
|
*/
|
|
16
|
+
import type { KeyValueMetaTable } from "@mailwoman/sqlite/database-schema";
|
|
17
17
|
/**
|
|
18
|
-
* The FTS5 virtual table
|
|
18
|
+
* The FTS5 virtual table this package builds on first open.
|
|
19
|
+
* It is local to this repository.
|
|
19
20
|
*
|
|
20
|
-
* `content` is unindexed
|
|
21
|
+
* `content` is unindexed and is there so we can roundtrip the original name
|
|
22
|
+
* back to the caller without a second select.
|
|
21
23
|
* The actual FTS rebuild happens in `fts.ts::buildPlaceSearchFTS`.
|
|
22
24
|
*/
|
|
23
25
|
export interface PlaceSearchTable {
|
|
@@ -27,16 +29,19 @@ export interface PlaceSearchTable {
|
|
|
27
29
|
alt_names: string | null;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
|
-
* `spr
|
|
31
|
-
*
|
|
32
|
+
* `spr`, the Who's On First "Standard Places Response": a denormalized lightweight
|
|
33
|
+
* summary of one row per place.
|
|
32
34
|
*
|
|
33
|
-
*
|
|
34
|
-
* `is_current = 1` (legacy Mapzen-era). Only `is_current = 0` means "not current". Filters in `lookup.ts` and `fts.ts`
|
|
35
|
-
* use `is_current != 0 AND is_deprecated = 0` — see #91 for the diagnostic that uncovered the mixed-convention
|
|
36
|
-
* reality.
|
|
35
|
+
* The resolver's main lookup table.
|
|
37
36
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* Lifecycle flags use two conventions, both meaning "currently valid": `is_current = -1`
|
|
38
|
+
* for modern Who's On First and `is_current = 1` for the legacy Mapzen era.
|
|
39
|
+
* Only `is_current = 0` means "not current".
|
|
40
|
+
*
|
|
41
|
+
* Filters in `lookup.ts` and `fts.ts` use `is_current != 0 and is_deprecated = 0`.
|
|
42
|
+
*
|
|
43
|
+
* Lat/lon live directly on this row, so centroid resolution needs no GeoJSON extraction.
|
|
44
|
+
* `min_*` and `max_*` form a bounding box if callers want one.
|
|
40
45
|
*/
|
|
41
46
|
export interface SprTable {
|
|
42
47
|
id: number;
|
|
@@ -60,15 +65,21 @@ export interface SprTable {
|
|
|
60
65
|
lastmodified: number;
|
|
61
66
|
}
|
|
62
67
|
/**
|
|
63
|
-
* Alternate names per place, keyed by language tag subfields (BCP-47 components).
|
|
64
|
-
*
|
|
65
|
-
*
|
|
68
|
+
* Alternate names per place, keyed by language tag subfields (BCP-47 components).
|
|
69
|
+
*
|
|
70
|
+
* Joins back to `spr.id` via `id`.
|
|
71
|
+
* The real WOF schema uses the same column name as the spr primary key, so this is
|
|
72
|
+
* a normal join across two tables with the same FK column name.
|
|
66
73
|
*
|
|
67
|
-
* No `kind` column in real WOF
|
|
74
|
+
* No `kind` column in real WOF.
|
|
75
|
+
* The FTS build concatenates all names per id.
|
|
68
76
|
*
|
|
69
|
-
* `official`
|
|
70
|
-
*
|
|
71
|
-
*
|
|
77
|
+
* `official` marks a preferred-form name in an official language of the place's country.
|
|
78
|
+
* This column appears only in unified builds.
|
|
79
|
+
*
|
|
80
|
+
* Real WOF dumps omit it.
|
|
81
|
+
* These are the aliases eligible to join the name-exact tier.
|
|
82
|
+
* See `unified-schema.ts` for the full interface.
|
|
72
83
|
*/
|
|
73
84
|
export interface NamesTable {
|
|
74
85
|
id: number;
|
|
@@ -86,8 +97,11 @@ export interface NamesTable {
|
|
|
86
97
|
lastmodified: number;
|
|
87
98
|
}
|
|
88
99
|
/**
|
|
89
|
-
* Per-place GeoJSON blob.
|
|
90
|
-
*
|
|
100
|
+
* Per-place GeoJSON blob.
|
|
101
|
+
*
|
|
102
|
+
* Centroid lat/lon are already exposed via `spr.{latitude,longitude}`,
|
|
103
|
+
* so the resolver does not need to parse this.
|
|
104
|
+
* The table stays modeled so a caller that wants the full geometry for bbox or polygon work can read it.
|
|
91
105
|
*/
|
|
92
106
|
export interface GeojsonTable {
|
|
93
107
|
id: number;
|
|
@@ -98,8 +112,10 @@ export interface GeojsonTable {
|
|
|
98
112
|
lastmodified: number;
|
|
99
113
|
}
|
|
100
114
|
/**
|
|
101
|
-
* Adjacency table for ancestor relationships.
|
|
102
|
-
*
|
|
115
|
+
* Adjacency table for ancestor relationships.
|
|
116
|
+
*
|
|
117
|
+
* One row per (place, ancestor) pair, including transitive ancestors.
|
|
118
|
+
* Used to implement `FindPlaceQuery.parentID` (descendant lookup).
|
|
103
119
|
*/
|
|
104
120
|
export interface AncestorsTable {
|
|
105
121
|
id: number;
|
|
@@ -108,25 +124,35 @@ export interface AncestorsTable {
|
|
|
108
124
|
lastmodified: number;
|
|
109
125
|
}
|
|
110
126
|
/**
|
|
111
|
-
* `place_population` — `id → wof:population`, split off `spr` so a population-rank
|
|
112
|
-
*
|
|
113
|
-
*
|
|
127
|
+
* `place_population` — `id → wof:population`, split off `spr` so a population-rank
|
|
128
|
+
* join is a single indexed probe.
|
|
129
|
+
*
|
|
130
|
+
* Written by the build/augment ingest + the GeoNames backfill.
|
|
131
|
+
* Read by the candidate build's `neg_rank`.
|
|
132
|
+
*
|
|
133
|
+
* WOF records population for ~15% of localities.
|
|
134
|
+
* Absent = unknown rather than zero.
|
|
114
135
|
*/
|
|
115
136
|
export interface PlacePopulationTable {
|
|
116
137
|
id: number;
|
|
117
138
|
population: number;
|
|
118
139
|
}
|
|
119
140
|
/**
|
|
120
|
-
* `place_abbr` — `id → abbreviation` (e.g. `IL → Illinois`), derived from
|
|
121
|
-
*
|
|
141
|
+
* `place_abbr` — `id → abbreviation` (e.g. `IL → Illinois`), derived from
|
|
142
|
+
* `names` rows whose `language = 'abbr'`.
|
|
143
|
+
*
|
|
144
|
+
* Lets the resolver accept a 2-letter region abbreviation as an exact match.
|
|
122
145
|
*/
|
|
123
146
|
export interface PlaceAbbrTable {
|
|
124
147
|
id: number;
|
|
125
148
|
abbr: string;
|
|
126
149
|
}
|
|
127
150
|
/**
|
|
128
|
-
* `concordances` — external-id cross-references per place (`id → (other_source, other_id)`),
|
|
129
|
-
*
|
|
151
|
+
* `concordances` — external-id cross-references per place (`id → (other_source, other_id)`),
|
|
152
|
+
* e.g. a GeoNames or Overture gers id.
|
|
153
|
+
*
|
|
154
|
+
* Metadata only.
|
|
155
|
+
* Not part of the resolve path.
|
|
130
156
|
*/
|
|
131
157
|
export interface ConcordancesTable {
|
|
132
158
|
id: number;
|
|
@@ -135,9 +161,12 @@ export interface ConcordancesTable {
|
|
|
135
161
|
lastmodified: number;
|
|
136
162
|
}
|
|
137
163
|
/**
|
|
138
|
-
* `coincident_roles
|
|
139
|
-
*
|
|
140
|
-
*
|
|
164
|
+
* `coincident_roles`.
|
|
165
|
+
*
|
|
166
|
+
* The dual-role relation, where a place is both an admin region and a locality (Berlin the city-state).
|
|
167
|
+
*
|
|
168
|
+
* One row per (admin, locality) pair the resolver can complete a hierarchy with.
|
|
169
|
+
* Surfaced by {@link MailwomanLookupLike.coincidentRolesFor}.
|
|
141
170
|
*/
|
|
142
171
|
export interface CoincidentRolesTable {
|
|
143
172
|
admin_id: number;
|
|
@@ -148,21 +177,15 @@ export interface CoincidentRolesTable {
|
|
|
148
177
|
locality_population: number;
|
|
149
178
|
}
|
|
150
179
|
/**
|
|
151
|
-
* The full schema we hand to `Kysely<WOFDatabase>` / `new DatabaseClient<WOFDatabase>(...)`.
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
* The provenance row every built extract carries: source fingerprints travelling WITH the database rather than in a
|
|
158
|
-
* document that can drift from it. Written by the postcode builders in `mailwoman/gazetteer-pipeline`.
|
|
180
|
+
* The full schema we hand to `Kysely<WOFDatabase>` / `new DatabaseClient<WOFDatabase>(...)`.
|
|
181
|
+
*
|
|
182
|
+
* Tables not listed here will fail type-checked queries, by design.
|
|
183
|
+
* The reader ({@link WOFSQLitePlaceLookup}) already consumes this.
|
|
184
|
+
*
|
|
185
|
+
* The build and augment writers adopt it so a column rename is a compile error on both sides.
|
|
159
186
|
*/
|
|
160
|
-
export interface ExtractMetaTable {
|
|
161
|
-
key: string;
|
|
162
|
-
value: string | null;
|
|
163
|
-
}
|
|
164
187
|
export interface WOFDatabase {
|
|
165
|
-
meta:
|
|
188
|
+
meta: KeyValueMetaTable;
|
|
166
189
|
place_search: PlaceSearchTable;
|
|
167
190
|
spr: SprTable;
|
|
168
191
|
names: NamesTable;
|
package/out/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.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MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,iBAAiB,CAAA;IACvB,YAAY,EAAE,gBAAgB,CAAA;IAC9B,GAAG,EAAE,QAAQ,CAAA;IACb,KAAK,EAAE,UAAU,CAAA;IACjB,OAAO,EAAE,YAAY,CAAA;IACrB,SAAS,EAAE,cAAc,CAAA;IACzB,gBAAgB,EAAE,oBAAoB,CAAA;IACtC,UAAU,EAAE,cAAc,CAAA;IAC1B,YAAY,EAAE,iBAAiB,CAAA;IAC/B,gBAAgB,EAAE,oBAAoB,CAAA;CACtC"}
|
package/out/schema.js
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
* Kysely table types for the subset of the Who's On First SQLite schema
|
|
6
|
+
* Kysely table types for the subset of the Who's On First SQLite schema this package touches.
|
|
7
7
|
*
|
|
8
|
-
* The full upstream distribution at data.geocode.earth/wof/dist/sqlite/ ships
|
|
9
|
-
* models only the
|
|
10
|
-
* verified their shapes and they're not part of the resolver's contract.
|
|
8
|
+
* The full upstream distribution at data.geocode.earth/wof/dist/sqlite/ ships about seven tables.
|
|
9
|
+
* This file models only the tables we read. The others are outside the resolver interface. Their shapes remain unverified.
|
|
11
10
|
*
|
|
12
11
|
* Authoritative schema docs:
|
|
13
12
|
*
|
|
14
|
-
* - Whosonfirst SQLite
|
|
13
|
+
* - Whosonfirst SQLite readme: https://github.com/whosonfirst/go-whosonfirst-sqlite
|
|
15
14
|
* - Per-table sources under https://github.com/whosonfirst/go-whosonfirst-sqlite-features
|
|
16
15
|
*/
|
|
17
16
|
export {};
|
package/out/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
package/out/search-fetch.d.ts
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Fetches FTS5 candidates for fuzzy name matching. It runs the schema-qualified `place_search` match and its
|
|
7
|
+
* population-ordered companion query. Both queries return the raw row shape defined here.
|
|
8
8
|
*
|
|
9
9
|
* Bbox and near-with-radius narrow at the SQL level through SQLite's built-in `rtree`, whose index name and schema
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* whole corpus, so
|
|
10
|
+
* are defined in `fts.ts` beside the FTS5 build. This package uses SQLite's R*Tree instead of SpatiaLite or turf.
|
|
11
|
+
* The R*Tree narrows the search to at most a few hundred candidates per query. Downstream passes work on that set
|
|
12
|
+
* instead of the whole corpus, so exact haversine calculations remain cheap.
|
|
13
13
|
*/
|
|
14
14
|
import type { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
15
15
|
import type { RankingWeights } from "#ranking-weights";
|
|
@@ -29,17 +29,21 @@ export interface RawSearchRow {
|
|
|
29
29
|
max_longitude: number | null;
|
|
30
30
|
population: number | null;
|
|
31
31
|
/**
|
|
32
|
-
* From `place_importance.encyclopedic` when the extract's table
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* From `place_importance.encyclopedic` when the extract's table includes the two-score split columns.
|
|
33
|
+
*
|
|
34
|
+
* NULL means the place has no Wikipedia article, or the extract predates the split.
|
|
35
|
+
* Either case records an absence.
|
|
36
|
+
* The value remains null rather than 0 (ROAD_TO_V9 §2).
|
|
35
37
|
*/
|
|
36
38
|
encyclopedic: number | null;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
|
-
* Fetch the raw candidate rows for a name match on one extract: the BM25-ordered
|
|
40
|
-
* for short queries), plus the population-ordered
|
|
41
|
-
*
|
|
42
|
-
*
|
|
41
|
+
* Fetch the raw candidate rows for a name match on one extract: the BM25-ordered
|
|
42
|
+
* window over `place_search` (widened for short queries), plus the population-ordered
|
|
43
|
+
* companion fetch that keeps the prominent holders of a name pool-complete.
|
|
44
|
+
*
|
|
45
|
+
* `schemaName` is the routed extract's bare schema name, validated at construction,
|
|
46
|
+
* so it is interpolated directly.
|
|
43
47
|
*/
|
|
44
48
|
export declare function fetchSearchRows<DB>(options: {
|
|
45
49
|
db: DatabaseClient<DB>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-fetch.d.ts","sourceRoot":"","sources":["../lib/search-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAA;AAG7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"search-fetch.d.ts","sourceRoot":"","sources":["../lib/search-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAA;AAG7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAkC1D,MAAM,WAAW,YAAY;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE;IAC5C,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,cAAc,CAAA;IACrB,UAAU,EAAE,YAAY,EAAE,GAAG,IAAI,CAAA;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC1C,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChD,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC1E,OAAO,EAAE,cAAc,CAAA;CACvB,GAAG,YAAY,EAAE,CAoLjB"}
|
package/out/search-fetch.js
CHANGED
|
@@ -3,61 +3,75 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Fetches FTS5 candidates for fuzzy name matching. It runs the schema-qualified `place_search` match and its
|
|
7
|
+
* population-ordered companion query. Both queries return the raw row shape defined here.
|
|
8
8
|
*
|
|
9
9
|
* Bbox and near-with-radius narrow at the SQL level through SQLite's built-in `rtree`, whose index name and schema
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* whole corpus, so
|
|
10
|
+
* are defined in `fts.ts` beside the FTS5 build. This package uses SQLite's R*Tree instead of SpatiaLite or turf.
|
|
11
|
+
* The R*Tree narrows the search to at most a few hundred candidates per query. Downstream passes work on that set
|
|
12
|
+
* instead of the whole corpus, so exact haversine calculations remain cheap.
|
|
13
13
|
*/
|
|
14
14
|
import { allRows } from "@mailwoman/core/utils";
|
|
15
15
|
import { bboxAround } from "@mailwoman/spatial";
|
|
16
|
-
import { PLACE_BBOX_TABLE, PLACE_POPULATION_TABLE } from "#fts
|
|
16
|
+
import { PLACE_BBOX_TABLE, PLACE_POPULATION_TABLE } from "#fts";
|
|
17
17
|
/**
|
|
18
|
-
* Query length at or below which the FTS window is widened.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Query length at or below which the FTS window is widened.
|
|
19
|
+
*
|
|
20
|
+
* A two- or three-character query is almost always a region abbreviation, where the exact match
|
|
21
|
+
* can otherwise fall outside the window behind higher-bm25 partial hits, as "NY" losing to "New York".
|
|
21
22
|
*/
|
|
22
23
|
const SHORT_QUERY_MAX_LENGTH = 3;
|
|
23
24
|
/**
|
|
24
|
-
* Over-fetch floor for
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* Over-fetch floor for short (≤3-character) queries.
|
|
26
|
+
*
|
|
27
|
+
* These queries are usually region abbreviations such as "NY" or "VT".
|
|
28
|
+
*
|
|
29
|
+
* An exact-abbrev holder's BM25 is poor (long multilingual alt-name document),
|
|
30
|
+
* so the normal `limit * 4` window can drop it before `exactMatchTiering` promotes
|
|
31
|
+
* it. 200 comfortably covers every same-abbrev region across the 12-country gazetteer
|
|
32
|
+
* (a 2-letter token matches a few dozen regions at most) while staying a cheap region-placetype fetch.
|
|
33
|
+
* See the `#fuzzyNameMatch` over-fetch comment.
|
|
29
34
|
*/
|
|
30
35
|
const SHORT_QUERY_OVERFETCH = 200;
|
|
31
36
|
/**
|
|
32
|
-
* How many rows the population-ordered companion fetch
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
37
|
+
* How many rows the population-ordered companion fetch adds to the candidate pool.
|
|
38
|
+
*
|
|
39
|
+
* Small on purpose.
|
|
40
|
+
* Its only job is to guarantee the famous holders of a name enter the pool at all.
|
|
41
|
+
*
|
|
42
|
+
* For "Paris"-class floods, thousands of small same-name rows fill the BM25 window.
|
|
43
|
+
* A boost inside the BM25-based ORDER BY cannot rescue a candidate whose score is
|
|
44
|
+
* length-poisoned by about 15 points (see the fetch-site comment).
|
|
36
45
|
*/
|
|
37
46
|
const POPULATION_FETCH_LIMIT = 15;
|
|
38
47
|
/**
|
|
39
|
-
* Fetch the raw candidate rows for a name match on one extract: the BM25-ordered
|
|
40
|
-
* for short queries), plus the population-ordered
|
|
41
|
-
*
|
|
42
|
-
*
|
|
48
|
+
* Fetch the raw candidate rows for a name match on one extract: the BM25-ordered
|
|
49
|
+
* window over `place_search` (widened for short queries), plus the population-ordered
|
|
50
|
+
* companion fetch that keeps the prominent holders of a name pool-complete.
|
|
51
|
+
*
|
|
52
|
+
* `schemaName` is the routed extract's bare schema name, validated at construction,
|
|
53
|
+
* so it is interpolated directly.
|
|
43
54
|
*/
|
|
44
55
|
export function fetchSearchRows(options) {
|
|
45
56
|
const { db, schemaName: sch, query, placetypes, ftsQuery, limit, hasBboxIndex, hasPopulationIndex, encyclopedicClauses, weights, } = options;
|
|
46
|
-
// Over-fetch so post-scoring
|
|
47
|
-
// region abbreviation like "NY"
|
|
48
|
-
// the
|
|
49
|
-
// so under the normal `limit * 4` window it
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
// postcode signal to disambiguate
|
|
54
|
-
// With a `country` hint every abbrev resolves; bare + no-context lifts 7→10/15 US states.)
|
|
57
|
+
// Over-fetch so post-scoring and exact-match tiering have room to re-rank.
|
|
58
|
+
// Short queries (a 2-3-char region abbreviation like "NY" or "VT") are the danger
|
|
59
|
+
// case the `exactMatchTiering` docstring flags.
|
|
60
|
+
// The exact-abbrev holder's BM25 is poor, so under the normal `limit * 4` window it
|
|
61
|
+
// drops out of the candidate pool before tiering can promote it.
|
|
62
|
+
// A wider window for short queries keeps the exact match available for tiering.
|
|
63
|
+
// Cross-country abbrev collisions ("VT" is both Vermont and Viterbo) still need a country
|
|
64
|
+
// or postcode signal to disambiguate, so this only rescues the window-drop class.
|
|
55
65
|
const ftsLimit = query.text.trim().length <= SHORT_QUERY_MAX_LENGTH ? Math.max(limit * 4, SHORT_QUERY_OVERFETCH) : limit * 4;
|
|
56
|
-
// Filter out historical
|
|
57
|
-
// spr table but should never win a contemporary lookup.
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
66
|
+
// Filter out historical, superseded and deprecated places by default.
|
|
67
|
+
// They live in the same spr table but should never win a contemporary lookup.
|
|
68
|
+
// `is_current = 0` is the only WOF value that means "not current", while both
|
|
69
|
+
// `-1` (modern) and `1` (legacy) mean current.
|
|
70
|
+
//
|
|
71
|
+
// The schema-qualified `from` makes the bare `place_search` reference in
|
|
72
|
+
// `match` resolve to the from table.
|
|
73
|
+
// The FTS5 parser requires that resolution.
|
|
74
|
+
// See the extracts.ts header comment.
|
|
61
75
|
const where = ["place_search MATCH ?", "spr.is_current != 0", "spr.is_deprecated = 0"];
|
|
62
76
|
const params = [ftsQuery];
|
|
63
77
|
if (placetypes && placetypes.length) {
|
|
@@ -72,21 +86,25 @@ export function fetchSearchRows(options) {
|
|
|
72
86
|
where.push(`(spr.parent_id = ? OR spr.id IN (SELECT id FROM ${sch}.ancestors WHERE ancestor_id = ?))`);
|
|
73
87
|
params.push(query.parentID, query.parentID);
|
|
74
88
|
}
|
|
75
|
-
// Bbox
|
|
76
|
-
// the active extract has the R*Tree
|
|
77
|
-
// filter
|
|
89
|
+
// Bbox and near-with-radius are SQL-level filters via the R*Tree.
|
|
90
|
+
// The join is emitted only when the active extract has the R*Tree.
|
|
91
|
+
// A requested filter on a legacy extract is silently treated as no bbox filter
|
|
92
|
+
// so the query does not crash.
|
|
78
93
|
const extractHasBbox = hasBboxIndex.get(sch) === true;
|
|
79
94
|
const useBboxJoin = (query.bbox || query.near?.maxDistanceKm !== undefined) && extractHasBbox;
|
|
80
95
|
let joinClause = `JOIN ${sch}.spr ON spr.id = place_search.wof_id`;
|
|
81
96
|
if (useBboxJoin) {
|
|
82
97
|
joinClause += ` JOIN ${sch}.${PLACE_BBOX_TABLE} bbox ON bbox.id = spr.id`;
|
|
83
|
-
//
|
|
98
|
+
// aabb intersection.
|
|
99
|
+
// Both bounding-box sides must overlap.
|
|
100
|
+
// The R*Tree checks them in O(log n).
|
|
84
101
|
const filterBox = query.bbox || bboxAround(query.near.lat, query.near.lon, query.near.maxDistanceKm);
|
|
85
102
|
where.push("bbox.min_lat <= ? AND bbox.max_lat >= ?", "bbox.min_lon <= ? AND bbox.max_lon >= ?");
|
|
86
103
|
params.push(filterBox.maxLat, filterBox.minLat, filterBox.maxLon, filterBox.minLon);
|
|
87
104
|
}
|
|
88
|
-
//
|
|
89
|
-
//
|
|
105
|
+
// Left join the population aux table when present.
|
|
106
|
+
// If this extract lacks the table, the select omits the population column.
|
|
107
|
+
// The post-scoring loop then uses 0.
|
|
90
108
|
const extractHasPopulation = hasPopulationIndex.get(sch) === true;
|
|
91
109
|
const populationSelect = extractHasPopulation
|
|
92
110
|
? `${PLACE_POPULATION_TABLE}.population AS population`
|
|
@@ -94,29 +112,30 @@ export function fetchSearchRows(options) {
|
|
|
94
112
|
const populationJoin = extractHasPopulation
|
|
95
113
|
? `LEFT JOIN ${sch}.${PLACE_POPULATION_TABLE} ON ${PLACE_POPULATION_TABLE}.id = spr.id`
|
|
96
114
|
: "";
|
|
97
|
-
// The encyclopedic score is
|
|
98
|
-
// appears in the
|
|
99
|
-
// split column, so a pre-split extract emits a literal NULL
|
|
115
|
+
// The encyclopedic score is returned and never ranked on (ROAD_TO_V9 §2).
|
|
116
|
+
// It appears in the select and in no order BY, here or in the companion fetch below.
|
|
117
|
+
// It is conditioned on the split column, so a pre-split extract emits a literal NULL
|
|
118
|
+
// and builds no join at all.
|
|
100
119
|
const { select: encyclopedicSelect, join: encyclopedicJoin } = encyclopedicClauses.get(sch);
|
|
101
|
-
// Push the population boost into the
|
|
102
|
-
// (whose long alt-name lists hurt BM25) actually make it into the over-fetch window.
|
|
103
|
-
// post-scoring will still compute the same boost for the final score
|
|
104
|
-
// candidate set is right.
|
|
120
|
+
// Push the population boost into the order BY when the index is available, so famous places
|
|
121
|
+
// (whose long alt-name lists hurt BM25) actually make it into the over-fetch window.
|
|
122
|
+
// The TS post-scoring will still compute the same boost for the final score.
|
|
123
|
+
// This just ensures the candidate set is right.
|
|
105
124
|
//
|
|
106
125
|
// Formula: rank_adjusted = bm25 - populationBoost * min(1.0, log10(1 + pop) / scaleLog10)
|
|
107
126
|
// Lower rank_adjusted = better (matches SQLite's bm25 convention of "more negative = better").
|
|
108
127
|
//
|
|
109
|
-
//
|
|
110
|
-
// bm25 length normalization is polluted by the row's
|
|
111
|
-
// `name` docs read −16.0 (empty alt_names)
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
128
|
+
// Do not reach for bm25 column weights here.
|
|
129
|
+
// FTS5's bm25 length normalization is polluted by the row's total document size,
|
|
130
|
+
// so identical 1-token `name` docs read −16.0 (empty alt_names) against −0.43
|
|
131
|
+
// (2.7 KB alt_names) even with the alt_names column weighted to zero.
|
|
132
|
+
// The population-ordered companion fetch below returns the most populous holder of the name.
|
|
133
|
+
// The post-scoring sort uses population to break ties in the exact tier.
|
|
115
134
|
const orderByExpr = extractHasPopulation
|
|
116
135
|
? `(bm25(place_search) - ? * MIN(1.0, COALESCE(log10(1.0 + ${PLACE_POPULATION_TABLE}.population), 0) / ?))`
|
|
117
136
|
: "bm25(place_search)";
|
|
118
|
-
// Schema-qualified
|
|
119
|
-
// See extracts.ts header for the failure mode that drove this design.
|
|
137
|
+
// Schema-qualified `from` with a bare-name `match` is required syntax for FTS5 on attached schemas.
|
|
138
|
+
// See the extracts.ts header for the failure mode that drove this design.
|
|
120
139
|
const stmt = db.prepare(`
|
|
121
140
|
SELECT
|
|
122
141
|
spr.id AS id,
|
|
@@ -143,12 +162,13 @@ export function fetchSearchRows(options) {
|
|
|
143
162
|
}
|
|
144
163
|
params.push(ftsLimit);
|
|
145
164
|
const rawRows = allRows(stmt, ...params);
|
|
146
|
-
//
|
|
147
|
-
// ("Paris" matches thousands of gap-fill villages) the bm25-based
|
|
148
|
-
// the famous holder
|
|
149
|
-
//
|
|
150
|
-
// prominent holders of a name
|
|
151
|
-
// decides whether they win.
|
|
165
|
+
// Companion fetch: the same `match`, ordered only by population.
|
|
166
|
+
// For name floods ("Paris" matches thousands of gap-fill villages) the bm25-based
|
|
167
|
+
// window above cannot admit the famous holder, because its bm25 is length-poisoned
|
|
168
|
+
// by the row's alias bulk (measured ~15 pts, against a +4.0 boost cap).
|
|
169
|
+
// This fetch includes prominent holders of a name in the candidate pool.
|
|
170
|
+
// The exact-tier sort below decides whether they win.
|
|
171
|
+
// It is skipped without a population index, since there is no column to order by.
|
|
152
172
|
if (extractHasPopulation) {
|
|
153
173
|
const popStmt = db.prepare(`
|
|
154
174
|
SELECT
|
package/out/search-fetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-fetch.js","sourceRoot":"","sources":["../lib/search-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/C,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,
|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C;IAED,OAAO,OAAO,CAAA;AACf,CAAC"}
|
|
@@ -2,28 +2,24 @@
|
|
|
2
2
|
* @copyright Sister Software
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* `SqliteConventionSource` — a `ConventionSource` backed by the build-from-source convention asset
|
|
7
|
-
* (#290, Direction E). Conventions live in a read-only, provenance-stamped `address_convention`
|
|
8
|
-
* table keyed by WOF polygon id; this source queries them ON DEMAND by id (one indexed lookup,
|
|
9
|
-
* memoized) rather than paging the whole table into memory as a code constant — the deliberate
|
|
10
|
-
* counter to the Pelias "giant dictionary in RAM, no provenance" pattern (see the operator design
|
|
11
|
-
* value in memory `feedback-no-irrelevant-trivia`).
|
|
12
|
-
*
|
|
13
|
-
* The asset is the queryable, distributable artifact; the strategy IMPLEMENTATIONS stay in code. An
|
|
14
|
-
* unknown strategy NAME is surfaced loudly at dispatch (see `lookup.ts`), not silently
|
|
15
|
-
* swallowed.
|
|
16
5
|
*/
|
|
17
6
|
import type { DatabaseClient } from "@mailwoman/sqlite/client";
|
|
18
|
-
import { type Convention, type ConventionSource } from "#convention
|
|
7
|
+
import { type Convention, type ConventionSource } from "#convention";
|
|
8
|
+
/**
|
|
9
|
+
* Reads per-place address conventions from the convention table in an attached
|
|
10
|
+
* SQLite schema, caching each lookup, including misses.
|
|
11
|
+
*
|
|
12
|
+
* A missing table or unparseable row reads as no convention rather than throwing.
|
|
13
|
+
*/
|
|
19
14
|
export declare class SqliteConventionSource<DB> implements ConventionSource {
|
|
20
15
|
#private;
|
|
21
16
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
17
|
+
* Creates a source over an open database that is, or has attached, the convention asset.
|
|
18
|
+
*
|
|
19
|
+
* @param db The open database handle.
|
|
20
|
+
* @param schema The schema that holds the convention table, either `main` or an attached extract's name.
|
|
25
21
|
*/
|
|
26
22
|
constructor(db: DatabaseClient<DB>, schema: string);
|
|
27
|
-
get(wofID: number): Convention |
|
|
23
|
+
get(wofID: number): Convention | null;
|
|
28
24
|
}
|
|
29
25
|
//# sourceMappingURL=convention-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convention-source.d.ts","sourceRoot":"","sources":["../../lib/sqlite/convention-source.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"convention-source.d.ts","sourceRoot":"","sources":["../../lib/sqlite/convention-source.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,EAA4B,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9F;;;;;GAKG;AACH,qBAAa,sBAAsB,CAAC,EAAE,CAAE,YAAW,gBAAgB;;IAMlE;;;;;OAKG;IACH,YAAY,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAGjD;IAED,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAqBpC;CACD"}
|