@mailwoman/resolver-wof-sqlite 4.16.2 → 5.0.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.
Files changed (154) hide show
  1. package/out/address-point-interpolation.d.ts.map +1 -1
  2. package/out/address-point-interpolation.js +6 -6
  3. package/out/address-point-interpolation.js.map +1 -1
  4. package/out/address-point-schema.d.ts +5 -6
  5. package/out/address-point-schema.d.ts.map +1 -1
  6. package/out/address-point-schema.js +7 -2
  7. package/out/address-point-schema.js.map +1 -1
  8. package/out/address-point.d.ts +22 -8
  9. package/out/address-point.d.ts.map +1 -1
  10. package/out/address-point.js +29 -13
  11. package/out/address-point.js.map +1 -1
  12. package/out/ancestry-backfill.d.ts +53 -0
  13. package/out/ancestry-backfill.d.ts.map +1 -0
  14. package/out/ancestry-backfill.js +150 -0
  15. package/out/ancestry-backfill.js.map +1 -0
  16. package/out/ancestry.d.ts +6 -6
  17. package/out/ancestry.d.ts.map +1 -1
  18. package/out/ancestry.js +6 -6
  19. package/out/ancestry.js.map +1 -1
  20. package/out/build-candidate-cli.d.ts.map +1 -1
  21. package/out/build-candidate-cli.js.map +1 -1
  22. package/out/build-candidate.d.ts +4 -5
  23. package/out/build-candidate.d.ts.map +1 -1
  24. package/out/build-candidate.js +15 -14
  25. package/out/build-candidate.js.map +1 -1
  26. package/out/build-coincident-roles-cli.d.ts.map +1 -1
  27. package/out/build-coincident-roles-cli.js.map +1 -1
  28. package/out/build-fts-cli.d.ts +1 -1
  29. package/out/build-fts-cli.d.ts.map +1 -1
  30. package/out/build-fts-cli.js +6 -6
  31. package/out/build-fts-cli.js.map +1 -1
  32. package/out/build-slim-cli.d.ts +1 -1
  33. package/out/build-slim-cli.d.ts.map +1 -1
  34. package/out/build-slim-cli.js +3 -3
  35. package/out/build-slim-cli.js.map +1 -1
  36. package/out/build-slim.d.ts +7 -8
  37. package/out/build-slim.d.ts.map +1 -1
  38. package/out/build-slim.js +9 -9
  39. package/out/build-slim.js.map +1 -1
  40. package/out/candidate-fts.d.ts +5 -7
  41. package/out/candidate-fts.d.ts.map +1 -1
  42. package/out/candidate-fts.js +5 -7
  43. package/out/candidate-fts.js.map +1 -1
  44. package/out/candidate-lookup.d.ts +7 -7
  45. package/out/candidate-lookup.d.ts.map +1 -1
  46. package/out/candidate-lookup.js +31 -35
  47. package/out/candidate-lookup.js.map +1 -1
  48. package/out/candidate-schema.d.ts +13 -14
  49. package/out/candidate-schema.d.ts.map +1 -1
  50. package/out/candidate-schema.js +9 -9
  51. package/out/candidate-schema.js.map +1 -1
  52. package/out/coincident-roles.d.ts +9 -11
  53. package/out/coincident-roles.d.ts.map +1 -1
  54. package/out/coincident-roles.js +7 -7
  55. package/out/coincident-roles.js.map +1 -1
  56. package/out/convention.d.ts +30 -35
  57. package/out/convention.d.ts.map +1 -1
  58. package/out/convention.js +19 -21
  59. package/out/convention.js.map +1 -1
  60. package/out/fst-autocomplete.d.ts +5 -5
  61. package/out/fst-autocomplete.d.ts.map +1 -1
  62. package/out/fst-autocomplete.js +12 -13
  63. package/out/fst-autocomplete.js.map +1 -1
  64. package/out/fst-builder.d.ts +7 -7
  65. package/out/fst-builder.d.ts.map +1 -1
  66. package/out/fst-builder.js +9 -9
  67. package/out/fst-builder.js.map +1 -1
  68. package/out/fst-deserialize-web.d.ts +4 -4
  69. package/out/fst-deserialize-web.d.ts.map +1 -1
  70. package/out/fst-deserialize-web.js +4 -4
  71. package/out/fst-deserialize-web.js.map +1 -1
  72. package/out/fst-matcher.d.ts +12 -12
  73. package/out/fst-matcher.d.ts.map +1 -1
  74. package/out/fst-matcher.js +25 -25
  75. package/out/fst-matcher.js.map +1 -1
  76. package/out/fst-serialize.d.ts +5 -5
  77. package/out/fst-serialize.d.ts.map +1 -1
  78. package/out/fst-serialize.js +7 -6
  79. package/out/fst-serialize.js.map +1 -1
  80. package/out/fst-types.d.ts +13 -13
  81. package/out/fts.d.ts +74 -80
  82. package/out/fts.d.ts.map +1 -1
  83. package/out/fts.js +65 -71
  84. package/out/fts.js.map +1 -1
  85. package/out/geo.d.ts +14 -15
  86. package/out/geo.d.ts.map +1 -1
  87. package/out/geo.js +8 -8
  88. package/out/geo.js.map +1 -1
  89. package/out/geonames-aliases.d.ts +18 -9
  90. package/out/geonames-aliases.d.ts.map +1 -1
  91. package/out/geonames-aliases.js +70 -12
  92. package/out/geonames-aliases.js.map +1 -1
  93. package/out/index.d.ts +9 -9
  94. package/out/index.js +7 -7
  95. package/out/interpolation.d.ts +8 -10
  96. package/out/interpolation.d.ts.map +1 -1
  97. package/out/interpolation.js +6 -6
  98. package/out/interpolation.js.map +1 -1
  99. package/out/lookup.d.ts +74 -81
  100. package/out/lookup.d.ts.map +1 -1
  101. package/out/lookup.js +114 -128
  102. package/out/lookup.js.map +1 -1
  103. package/out/postal-city-alias-lookup.d.ts +9 -10
  104. package/out/postal-city-alias-lookup.d.ts.map +1 -1
  105. package/out/postal-city-alias-lookup.js +13 -14
  106. package/out/postal-city-alias-lookup.js.map +1 -1
  107. package/out/postal-city-alias-schema.d.ts +5 -6
  108. package/out/postal-city-alias-schema.d.ts.map +1 -1
  109. package/out/postal-city-alias-schema.js +3 -4
  110. package/out/postal-city-alias-schema.js.map +1 -1
  111. package/out/postal-city-candidate-schema.d.ts +7 -10
  112. package/out/postal-city-candidate-schema.d.ts.map +1 -1
  113. package/out/postal-city-candidate-schema.js +4 -6
  114. package/out/postal-city-candidate-schema.js.map +1 -1
  115. package/out/postcode-point-lookup.d.ts +3 -4
  116. package/out/postcode-point-lookup.d.ts.map +1 -1
  117. package/out/postcode-point-lookup.js +2 -2
  118. package/out/postcode-point-lookup.js.map +1 -1
  119. package/out/reverse.d.ts +26 -29
  120. package/out/reverse.d.ts.map +1 -1
  121. package/out/reverse.js +36 -38
  122. package/out/reverse.js.map +1 -1
  123. package/out/schema.d.ts +32 -33
  124. package/out/schema.d.ts.map +1 -1
  125. package/out/sharding.d.ts +26 -28
  126. package/out/sharding.d.ts.map +1 -1
  127. package/out/sharding.js +16 -16
  128. package/out/sharding.js.map +1 -1
  129. package/out/sqlite-convention-source.d.ts +3 -3
  130. package/out/sqlite-convention-source.d.ts.map +1 -1
  131. package/out/sqlite-convention-source.js +6 -6
  132. package/out/sqlite-convention-source.js.map +1 -1
  133. package/out/sqlite-utils.d.ts +4 -5
  134. package/out/sqlite-utils.d.ts.map +1 -1
  135. package/out/sqlite-utils.js +4 -5
  136. package/out/sqlite-utils.js.map +1 -1
  137. package/out/street-morphology-fst-builder.d.ts +15 -18
  138. package/out/street-morphology-fst-builder.d.ts.map +1 -1
  139. package/out/street-morphology-fst-builder.js +17 -17
  140. package/out/street-morphology-fst-builder.js.map +1 -1
  141. package/out/street-normalize.d.ts +43 -28
  142. package/out/street-normalize.d.ts.map +1 -1
  143. package/out/street-normalize.js +96 -34
  144. package/out/street-normalize.js.map +1 -1
  145. package/out/street-segment-schema.d.ts +5 -5
  146. package/out/street-segment-schema.js +2 -2
  147. package/out/types.d.ts +42 -47
  148. package/out/types.d.ts.map +1 -1
  149. package/out/types.js +1 -1
  150. package/out/unified-schema.d.ts +6 -6
  151. package/out/unified-schema.d.ts.map +1 -1
  152. package/out/unified-schema.js +10 -10
  153. package/out/unified-schema.js.map +1 -1
  154. package/package.json +26 -22
package/out/index.js CHANGED
@@ -3,20 +3,20 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
- export { WofSqlitePlaceLookup } from "./lookup.js";
7
- export { CANDIDATE_FTS_TABLE, createCandidateFts } from "./candidate-fts.js";
8
- export { WofCandidateTableLookup } from "./candidate-lookup.js";
6
+ export { WOFSqlitePlaceLookup } from "./lookup.js";
7
+ export { CANDIDATE_FTS_TABLE, createCandidateFTS } from "./candidate-fts.js";
8
+ export { WOFCandidateTableLookup } from "./candidate-lookup.js";
9
9
  export { GEONAMES_ID_BASE, ingestGeonamesAliases } from "./geonames-aliases.js";
10
10
  export { ADDRESS_POINT_COLUMNS, createAddressPointIndexes, createAddressPointTable } from "./address-point-schema.js";
11
- export { WofPostalCityAliasLookup, } from "./postal-city-alias-lookup.js";
11
+ export { WOFPostalCityAliasLookup, } from "./postal-city-alias-lookup.js";
12
12
  export { POSTAL_CITY_CANDIDATE_COLUMNS, POSTAL_CITY_CANDIDATE_TABLE, createPostalCityCandidateTable, } from "./postal-city-candidate-schema.js";
13
13
  export { ADDRESS_CONVENTION_TABLE, BUILTIN_STRATEGY_NAMES, SeedConventionSource, WORLD_DEFAULT, mergeConventions, resolveConvention, } from "./convention.js";
14
14
  export { SqliteConventionSource } from "./sqlite-convention-source.js";
15
- export { WofPostcodeLookup } from "./postcode-point-lookup.js";
16
- export { PLACE_BBOX_TABLE, PLACE_SEARCH_TABLE, buildPlaceSearchFts, placeBboxExists, placeSearchFtsExists, } from "./fts.js";
15
+ export { WOFPostcodeLookup } from "./postcode-point-lookup.js";
16
+ export { PLACE_BBOX_TABLE, PLACE_SEARCH_TABLE, buildPlaceSearchFTS, placeBboxExists, placeSearchFTSExists, } from "./fts.js";
17
17
  export { bboxAround, geometryContains, haversineKm, pointInPolygonRings, pointInRing, } from "./geo.js";
18
18
  export { PLACETYPE_DEPTH, ancestorLineage, placetypeDepth } from "./ancestry.js";
19
- export { WofReverseGeocoder, } from "./reverse.js";
19
+ export { WOFReverseGeocoder, } from "./reverse.js";
20
20
  export { AddressPointInterpolator } from "./address-point-interpolation.js";
21
21
  export { AddressPointSqliteLookup } from "./address-point.js";
22
22
  export { StreetInterpolator, } from "./interpolation.js";
@@ -32,8 +32,8 @@ import type { InterpolationLookup } from "@mailwoman/resolver";
32
32
  *
33
33
  * - `address_point` — bracketed/extrapolated between REAL neighbor points from the #476 shard
34
34
  * (`AddressPointInterpolator`), replacing TIGER's uniform-spacing assumption with occupancy.
35
- * - `tiger_range` — linear position within a TIGER segment's theoretical house-number range
36
- * (`StreetInterpolator`), the fallback for streets too sparse to bracket.
35
+ * - `tiger_range` — linear position within a TIGER segment's theoretical house-number range (`StreetInterpolator`), the
36
+ * fallback for streets too sparse to bracket.
37
37
  */
38
38
  export type InterpolationMethod = "address_point" | "tiger_range";
39
39
  /** One interpolated coordinate estimate. Never an exact situs point — see `uncertaintyM`. */
@@ -45,20 +45,18 @@ export interface InterpolatedHit {
45
45
  /** Which rung answered — see {@link InterpolationMethod}. */
46
46
  method: InterpolationMethod;
47
47
  /**
48
- * `tiger_range` only. True when the matched segment side's parity agrees with the house number
49
- * (or the side is `mixed`). False = opposite-side fallback: usually the right block, wrong side
50
- * of the street.
48
+ * `tiger_range` only. True when the matched segment side's parity agrees with the house number (or the side is
49
+ * `mixed`). False = opposite-side fallback: usually the right block, wrong side of the street.
51
50
  */
52
51
  parityMatched?: boolean;
53
52
  /**
54
- * `address_point` only. `both` = the query number sits between two known neighbor numbers;
55
- * `single` = neighbors exist on one side only (extrapolated, larger `uncertaintyM`).
53
+ * `address_point` only. `both` = the query number sits between two known neighbor numbers; `single` = neighbors exist
54
+ * on one side only (extrapolated, larger `uncertaintyM`).
56
55
  */
57
56
  bracket?: "both" | "single";
58
57
  /**
59
- * Honest uncertainty radius in meters: half the matched segment's polyline length
60
- * (`tiger_range`), half the bracket span (`address_point`/`both`), or the explicitly larger
61
- * extrapolation penalty (`address_point`/`single`).
58
+ * Honest uncertainty radius in meters: half the matched segment's polyline length (`tiger_range`), half the bracket
59
+ * span (`address_point`/`both`), or the explicitly larger extrapolation penalty (`address_point`/`single`).
62
60
  */
63
61
  uncertaintyM: number;
64
62
  /** Provenance, e.g. `"tiger:edges"`. */
@@ -1 +1 @@
1
- {"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../interpolation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAM9D;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG,eAAe,G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M,CAAA;IACX,yFAAyF;IACzF,YAAY,EAAE,IAAI,CAAA;IAClB,6DAA6D;IAC7D,MAAM,EAAE,mBAAmB,CAAA;IAC3B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IAC3B;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAA;CACjB;AAcD,qBAAa,kBAAmB,YAAW,mBAAmB;;gBAMjD,IAAI,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;KAAE;IA0B9D,IAAI,CAAC,KAAK,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI;IAwDvD,KAAK,IAAI,IAAI;CAGb"}
@@ -31,17 +31,17 @@ import { hasTable } from "./sqlite-utils.js";
31
31
  import { canonicalizeRouteKey, normalizeStreetForKey } from "./street-normalize.js";
32
32
  export class StreetInterpolator {
33
33
  #db;
34
- #ownsDb;
34
+ #ownsDB;
35
35
  #byPostcode;
36
36
  #byStreet;
37
37
  constructor(opts) {
38
38
  if (opts.database) {
39
39
  this.#db = opts.database;
40
- this.#ownsDb = false;
40
+ this.#ownsDB = false;
41
41
  }
42
42
  else if (opts.dbPath) {
43
43
  this.#db = new DatabaseSync(opts.dbPath, { readOnly: true });
44
- this.#ownsDb = true;
44
+ this.#ownsDB = true;
45
45
  }
46
46
  else {
47
47
  throw new Error("StreetInterpolator: one of dbPath or database is required");
@@ -108,7 +108,7 @@ export class StreetInterpolator {
108
108
  };
109
109
  }
110
110
  close() {
111
- if (this.#ownsDb)
111
+ if (this.#ownsDB)
112
112
  this.#db.close();
113
113
  }
114
114
  }
@@ -116,8 +116,8 @@ function clamp01(t) {
116
116
  return t < 0 ? 0 : t > 1 ? 1 : t;
117
117
  }
118
118
  /**
119
- * Point at fraction `t` of the polyline's total arc length (haversine), plus the total length in
120
- * km. `t` is assumed clamped to [0, 1].
119
+ * Point at fraction `t` of the polyline's total arc length (haversine), plus the total length in km. `t` is assumed
120
+ * clamped to [0, 1].
121
121
  */
122
122
  function pointAlong(polyline, t) {
123
123
  const legs = [];
@@ -1 +1 @@
1
- {"version":3,"file":"interpolation.js","sourceRoot":"","sources":["../interpolation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI1C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AA8DnF,MAAM,OAAO,kBAAkB;IACrB,GAAG,CAAc;IACjB,OAAO,CAAS;IAChB,WAAW,CAAiD;IAC5D,SAAS,CAAiD;IAEnE,YAAY,IAAkD;QAC7D,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAA;YACxB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACrB,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;YAC5D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACpB,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,2DAA2D,C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AAA;IACjB,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAE,CAAA;IAEjD,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
package/out/lookup.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
- * `WofSqlitePlaceLookup` — the resolver implementation backed by `node:sqlite` + a Kysely-typed
6
+ * `WOFSqlitePlaceLookup` — the resolver implementation backed by `node:sqlite` + a Kysely-typed
7
7
  * query layer where the queries are non-trivial, and raw SQL where they aren't (FTS5 MATCH, the
8
8
  * FTS index build).
9
9
  *
@@ -12,59 +12,58 @@
12
12
  import { DatabaseSync } from "node:sqlite";
13
13
  import { type Ancestor, type CoincidentLocality } from "@mailwoman/resolver";
14
14
  import { type Convention, type ConventionSource } from "./convention.js";
15
- import type { WofPostalCityAliasLookup } from "./postal-city-alias-lookup.js";
15
+ import type { WOFPostalCityAliasLookup } from "./postal-city-alias-lookup.js";
16
16
  import { type ShardConfig } from "./sharding.js";
17
17
  import type { FindPlaceQuery, PlaceCandidate, PlaceLookup } from "./types.js";
18
- export interface WofSqlitePlaceLookupOpts {
18
+ export interface WOFSqlitePlaceLookupOpts {
19
19
  /**
20
20
  * Path to the WOF SQLite distribution on disk. Mutually exclusive with `database`.
21
21
  *
22
22
  * **Single string** — opens that one DB as the main shard.
23
23
  *
24
- * **Array** — opens the first entry as main, then ATTACHes each subsequent entry as a separate
25
- * SQLite schema. Schema names are derived from the filename (`whosonfirst-data-postalcode-
26
- * us-latest.db` → `postalcode_us`); override with `ShardConfig.schemaName` when the filename
27
- * doesn't follow WOF convention. See `sharding.ts` for the derivation rules.
24
+ * **Array** — opens the first entry as main, then ATTACHes each subsequent entry as a separate SQLite schema. Schema
25
+ * names are derived from the filename (`whosonfirst-data-postalcode- us-latest.db` → `postalcode_us`); override with
26
+ * `ShardConfig.schemaName` when the filename doesn't follow WOF convention. See `sharding.ts` for the derivation
27
+ * rules.
28
28
  *
29
- * Routing: queries with a `placetype` matching a shard's name (or explicit `placetypes` hint) are
30
- * sent to that shard; everything else hits main. Cross-shard UNION is NOT done — BM25 isn't
31
- * comparable across separately-indexed corpora.
29
+ * Routing: queries with a `placetype` matching a shard's name (or explicit `placetypes` hint) are sent to that shard;
30
+ * everything else hits main. Cross-shard UNION is NOT done — BM25 isn't comparable across separately-indexed
31
+ * corpora.
32
32
  */
33
33
  databasePath?: string | ReadonlyArray<string | ShardConfig>;
34
34
  /**
35
- * Pre-opened DatabaseSync — primarily for tests against an inline fixture DB. Mutually exclusive
36
- * with `databasePath`. Multi-shard requires `databasePath` (so the lookup owns the ATTACH).
35
+ * Pre-opened DatabaseSync — primarily for tests against an inline fixture DB. Mutually exclusive with `databasePath`.
36
+ * Multi-shard requires `databasePath` (so the lookup owns the ATTACH).
37
37
  */
38
38
  database?: DatabaseSync;
39
39
  /**
40
- * If true, build the FTS5 `place_search` virtual table on construction if it doesn't already
41
- * exist. The upstream WOF distribution does NOT ship FTS5, so callers either set this once on
42
- * first open or pre-build it via the operator-side CLI documented in the README. Default false —
43
- * the resolver assumes the index already exists and errors loudly if it doesn't.
40
+ * If true, build the FTS5 `place_search` virtual table on construction if it doesn't already exist. The upstream WOF
41
+ * distribution does NOT ship FTS5, so callers either set this once on first open or pre-build it via the
42
+ * operator-side CLI documented in the README. Default false — the resolver assumes the index already exists and
43
+ * errors loudly if it doesn't.
44
44
  *
45
- * With multi-shard, `buildFts: true` builds the index on the **main** shard only. Other shards
46
- * must be pre-built via `mailwoman-wof-build-fts` — operator script for predictable cost.
45
+ * With multi-shard, `buildFTS: true` builds the index on the **main** shard only. Other shards must be pre-built via
46
+ * `mailwoman-wof-build-fts` — operator script for predictable cost.
47
47
  */
48
- buildFts?: boolean;
48
+ buildFTS?: boolean;
49
49
  /**
50
- * Geographic Rule Engine convention source (Direction E, #289). Per-WOF-polygon resolution
51
- * profiles, either as a ready `ConventionSource` or a plain `{ wofId: Convention }` seed map.
52
- * Default empty — every query rides `WORLD_DEFAULT` (the EU coordinate-first behavior). JP/KR/TW
53
- * add rows; #290 wires a build-from-source sqlite-backed source here.
50
+ * Geographic Rule Engine convention source (Direction E, #289). Per-WOF-polygon resolution profiles, either as a
51
+ * ready `ConventionSource` or a plain `{ wofID: Convention }` seed map. Default empty — every query rides
52
+ * `WORLD_DEFAULT` (the EU coordinate-first behavior). JP/KR/TW add rows; #290 wires a build-from-source sqlite-backed
53
+ * source here.
54
54
  */
55
55
  conventions?: ConventionSource | Record<number, Convention>;
56
56
  /**
57
- * Opt-in postal-city alias reader (#475). When supplied, the coordinate-first locality scorer
58
- * treats an observed `postal_city` ("Antioch", postcode 37013) as a name-match alias for the
59
- * geographic locality the postcode sits in ("Nashville"), recovering the chronic postal-vs-
60
- * geographic-city mismatch. Absent (the default), the resolver is byte-identical — every alias
61
- * code path is gated on this being non-null, so an unprovided reader changes no score.
57
+ * Opt-in postal-city alias reader (#475). When supplied, the coordinate-first locality scorer treats an observed
58
+ * `postal_city` ("Antioch", postcode 37013) as a name-match alias for the geographic locality the postcode sits in
59
+ * ("Nashville"), recovering the chronic postal-vs- geographic-city mismatch. Absent (the default), the resolver is
60
+ * byte-identical — every alias code path is gated on this being non-null, so an unprovided reader changes no score.
62
61
  */
63
- postalCityAliases?: WofPostalCityAliasLookup;
62
+ postalCityAliases?: WOFPostalCityAliasLookup;
64
63
  }
65
64
  /**
66
- * Ranking weights for `findPlace`. Tweakable per-instance but defaults match the values declared in
67
- * the Phase 4.2 plan doc.
65
+ * Ranking weights for `findPlace`. Tweakable per-instance but defaults match the values declared in the Phase 4.2 plan
66
+ * doc.
68
67
  */
69
68
  export interface RankingWeights {
70
69
  /** Boost when the candidate's placetype matches an explicit `placetype` filter. */
@@ -73,89 +72,83 @@ export interface RankingWeights {
73
72
  localityImplicitBoost: number;
74
73
  /** Boost when the candidate's country matches an explicit `country` filter. */
75
74
  countryMatchBoost: number;
76
- /** Boost when the candidate is a direct child of the requested `parentId`. */
75
+ /** Boost when the candidate is a direct child of the requested `parentID`. */
77
76
  directChildBoost: number;
78
- /** Boost when the candidate is a transitive descendant of the requested `parentId`. */
77
+ /** Boost when the candidate is a transitive descendant of the requested `parentID`. */
79
78
  descendantBoost: number;
80
79
  /** Multiplier on the length-penalty term (penalizes much-longer-than-query names). */
81
80
  lengthPenaltyWeight: number;
82
81
  /**
83
- * Magnitude of the proximity boost when the query carries `near`. The contribution is
84
- * `proximityBoost / (1 + distanceKm / proximityScaleKm)` — at distance 0 the boost is full
85
- * magnitude, at `proximityScaleKm` it's half, decaying further with distance. Default tuned so
86
- * proximity can overcome a typical FTS rank tie but not dominate a strong text match.
82
+ * Magnitude of the proximity boost when the query carries `near`. The contribution is `proximityBoost / (1 +
83
+ * distanceKm / proximityScaleKm)` — at distance 0 the boost is full magnitude, at `proximityScaleKm` it's half,
84
+ * decaying further with distance. Default tuned so proximity can overcome a typical FTS rank tie but not dominate a
85
+ * strong text match.
87
86
  */
88
87
  proximityBoost: number;
89
88
  /** Distance (km) at which the proximity boost halves. Tune to the typical query radius. */
90
89
  proximityScaleKm: number;
91
90
  /**
92
- * Magnitude of the population boost when the candidate has a known `wof:population`. The
93
- * contribution is `populationBoost * log10(1 + population) / populationScaleLog10`, capped at
94
- * `populationBoost`. WOF only carries population for ~15% of localities (mostly larger ones);
95
- * places without it get +0 (never a penalty). Default tuned so the famous Springfield, IL (pop
96
- * ~112k) gets ~0.42 boost — enough to nudge past tiny same-name peers.
91
+ * Magnitude of the population boost when the candidate has a known `wof:population`. The contribution is
92
+ * `populationBoost * log10(1 + population) / populationScaleLog10`, capped at `populationBoost`. WOF only carries
93
+ * population for ~15% of localities (mostly larger ones); places without it get +0 (never a penalty). Default tuned
94
+ * so the famous Springfield, IL (pop ~112k) gets ~0.42 boost — enough to nudge past tiny same-name peers.
97
95
  */
98
96
  populationBoost: number;
99
97
  /**
100
- * Population (in log10) at which the boost reaches its full magnitude. Default 6 — i.e. a
101
- * population of 1,000,000 gives `populationBoost` exactly. Larger populations cap at the same
102
- * value (no compounding effect for megacities).
98
+ * Population (in log10) at which the boost reaches its full magnitude. Default 6 — i.e. a population of 1,000,000
99
+ * gives `populationBoost` exactly. Larger populations cap at the same value (no compounding effect for megacities).
103
100
  */
104
101
  populationScaleLog10: number;
105
102
  /**
106
- * Tier candidates with an EXACT name/alias match above candidates that only match partially,
107
- * BEFORE the weighted-sum score is consulted. Default true.
103
+ * Tier candidates with an EXACT name/alias match above candidates that only match partially, BEFORE the weighted-sum
104
+ * score is consulted. Default true.
108
105
  *
109
- * Why this is needed (and why it ALIGNS with — rather than overrides — the population/importance
110
- * signal): the weighted sum adds population as a large additive boost (`populationBoost`, up to
111
- * +4) so that famous places surface for unambiguous full-name queries. But population is a
112
- * _prominence prior_ — its job is to break ties among candidates that match the query EQUALLY
113
- * WELL (e.g. "Springfield" → Springfield IL over Springfield MA, both exact name matches). It was
114
- * never meant to promote a place that matches the query WORSE. For a 2-letter region abbreviation
115
- * that backfires: querying "ME" returns Maine (which has the exact alias `ME`) AND Missouri/
116
- * Michigan/etc. (which do not), and Missouri's larger population (+4) overcomes Maine's bm25 edge
117
- * — so "Portland, ME" resolves its region to Missouri and the locality then cascades to the wrong
118
- * state. Tiering restores the intended ordering: **match quality is the primary key, prominence
119
- * (population) the secondary key WITHIN a tier.** Springfield-IL-over-MA still works (both exact
120
- * → same tier → population decides); ME→Maine now works (only Maine is exact → higher tier →
121
- * population never gets to override it). See
106
+ * Why this is needed (and why it ALIGNS with — rather than overrides — the population/importance signal): the
107
+ * weighted sum adds population as a large additive boost (`populationBoost`, up to +4) so that famous places surface
108
+ * for unambiguous full-name queries. But population is a _prominence prior_ — its job is to break ties among
109
+ * candidates that match the query EQUALLY WELL (e.g. "Springfield" → Springfield IL over Springfield MA, both exact
110
+ * name matches). It was never meant to promote a place that matches the query WORSE. For a 2-letter region
111
+ * abbreviation that backfires: querying "ME" returns Maine (which has the exact alias `ME`) AND Missouri/
112
+ * Michigan/etc. (which do not), and Missouri's larger population (+4) overcomes Maine's bm25 edge — so "Portland, ME"
113
+ * resolves its region to Missouri and the locality then cascades to the wrong state. Tiering restores the intended
114
+ * ordering: **match quality is the primary key, prominence (population) the secondary key WITHIN a tier.**
115
+ * Springfield-IL-over-MA still works (both exact → same tier → population decides); ME→Maine now works (only Maine is
116
+ * exact → higher tier → population never gets to override it). See
122
117
  * docs/articles/evals/2026-05-30-resolver-exact-match.md.
123
118
  *
124
- * Note: tiering re-ranks within the over-fetched candidate window (`limit * 4`); a pathological
125
- * exact match that falls outside that window is not rescued. For the region-abbrev case the
126
- * window is comfortably sufficient (a handful of states match a 2-letter query).
119
+ * Note: tiering re-ranks within the over-fetched candidate window (`limit * 4`); a pathological exact match that
120
+ * falls outside that window is not rescued. For the region-abbrev case the window is comfortably sufficient (a
121
+ * handful of states match a 2-letter query).
127
122
  */
128
123
  exactMatchTiering: boolean;
129
124
  }
130
125
  /** Padded character-trigram set (a leading/trailing space pads short tokens). */
131
126
  export declare function trigrams(s: string): Set<string>;
132
127
  /**
133
- * Character-trigram Jaccard ∈ [0,1] — tolerant of the swallowed-leading-char fragments ("auen" vs
134
- * "plauen") and minor misspellings without a heavyweight edit-distance pass. Shared with the
135
- * candidate backend's FTS5-trigram fuzzy fallback so both lookups rank typos identically.
128
+ * Character-trigram Jaccard ∈ [0,1] — tolerant of the swallowed-leading-char fragments ("auen" vs "plauen") and minor
129
+ * misspellings without a heavyweight edit-distance pass. Shared with the candidate backend's FTS5-trigram fuzzy
130
+ * fallback so both lookups rank typos identically.
136
131
  */
137
132
  export declare function trigramJaccard(a: string, b: string): number;
138
- export declare class WofSqlitePlaceLookup implements PlaceLookup, Disposable {
133
+ export declare class WOFSqlitePlaceLookup implements PlaceLookup, Disposable {
139
134
  #private;
140
- constructor(opts: WofSqlitePlaceLookupOpts, weights?: Partial<RankingWeights>);
135
+ constructor(opts: WOFSqlitePlaceLookupOpts, weights?: Partial<RankingWeights>);
141
136
  findPlace(query: FindPlaceQuery): Promise<PlaceCandidate[]>;
142
137
  /**
143
- * Dual-role localities coincident with an admin id, from the precomputed `coincident_roles`
144
- * relation (#403). Backs {@link ResolveOpts.hierarchyCompletion} (#405): O(1) once the relation is
145
- * loaded. Returns `[]` when the relation table is absent (older DB) or the admin isn't a
146
- * dual-role place, so completion degrades gracefully. The relation + `spr` join is loaded once
147
- * and memoized.
138
+ * Dual-role localities coincident with an admin id, from the precomputed `coincident_roles` relation (#403). Backs
139
+ * {@link ResolveOpts.hierarchyCompletion} (#405): O(1) once the relation is loaded. Returns `[]` when the relation
140
+ * table is absent (older DB) or the admin isn't a dual-role place, so completion degrades gracefully. The relation +
141
+ * `spr` join is loaded once and memoized.
148
142
  */
149
- coincidentLocalitiesFor(adminId: number | string): CoincidentLocality[];
143
+ coincidentLocalitiesFor(adminID: number | string): CoincidentLocality[];
150
144
  /**
151
- * The ancestor lineage of a place — its containment chain joined with `spr` for canonical names,
152
- * ordered NEAREST-FIRST (localadmin → county → region → … → country). Backs
153
- * {@link ResolveOpts.includeAncestors} (#404). Self is excluded; memoized per id. Returns `[]`
154
- * when the place has no recorded ancestry.
145
+ * The ancestor lineage of a place — its containment chain joined with `spr` for canonical names, ordered
146
+ * NEAREST-FIRST (localadmin → county → region → … → country). Backs {@link ResolveOpts.includeAncestors} (#404). Self
147
+ * is excluded; memoized per id. Returns `[]` when the place has no recorded ancestry.
155
148
  *
156
- * The walk itself lives in `ancestry.ts` (shared with the reverse geocoder, #484); the ordering
157
- * is its `PLACETYPE_DEPTH` table — same ranking as the previous inline SQL CASE, extended below
158
- * `localadmin` so locality/neighbourhood ancestors order correctly instead of sorting last.
149
+ * The walk itself lives in `ancestry.ts` (shared with the reverse geocoder, #484); the ordering is its
150
+ * `PLACETYPE_DEPTH` table — same ranking as the previous inline SQL CASE, extended below `localadmin` so
151
+ * locality/neighbourhood ancestors order correctly instead of sorting last.
159
152
  */
160
153
  ancestors(id: number | string): Ancestor[];
161
154
  close(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../lookup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAA;AAI9D,OAAO,EAAyB,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACnG,OAAO,EAIN,KAAK,UAAU,EACf,KAAK,gBAAgB,EAGrB,MAAM,iBAAiB,CAAA;AAcxB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAE7E,OAAO,EAA4D,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAE1G,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAgB,MAAM,YAAY,CAAA;AAE3F,MAAM,WAAW,wBAAwB;IACxC;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,CAAA;IAC3D;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC3D;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,wBAAwB,CAAA;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,mFAAmF;IACnF,mBAAmB,EAAE,MAAM,CAAA;IAC3B,sFAAsF;IACtF,qBAAqB,EAAE,MAAM,CAAA;IAC7B,+EAA+E;IAC/E,iBAAiB,EAAE,MAAM,CAAA;IACzB,8EAA8E;IAC9E,gBAAgB,EAAE,MAAM,CAAA;IACxB,uFAAuF;IACvF,eAAe,EAAE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