@mountainpass/addressr 2.3.0 → 2.4.1
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.
|
@@ -862,7 +862,13 @@ async function searchForAddress(searchString, p, pageSize = PAGE_SIZE) {
|
|
|
862
862
|
multi_match: {
|
|
863
863
|
fields: ['sla', 'ssla'],
|
|
864
864
|
query: searchString,
|
|
865
|
-
|
|
865
|
+
// ADR 027: AUTO:5,8 (not default AUTO / AUTO:3,6) so that
|
|
866
|
+
// 3-4 digit street numbers and postcodes require exact
|
|
867
|
+
// match. Default AUTO lets `138` fuzzy-match `137`, `135`
|
|
868
|
+
// etc., which tf-inflates adjacent-number docs above the
|
|
869
|
+
// actual target (P026). 5+ char tokens still get 1 edit
|
|
870
|
+
// (Muray → Murray), 8+ char tokens get 2 edits.
|
|
871
|
+
fuzziness: 'AUTO:5,8',
|
|
866
872
|
type: 'bool_prefix',
|
|
867
873
|
lenient: true,
|
|
868
874
|
auto_generate_synonyms_phrase_query: false,
|
|
@@ -3,23 +3,29 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SPAN_CAP = void 0;
|
|
7
6
|
exports.expandRangeAliases = expandRangeAliases;
|
|
8
|
-
// ADR 026: range-
|
|
7
|
+
// ADR 028 (supersedes ADR 026): endpoint-only range-address expansion.
|
|
9
8
|
// Pure helper — no I/O, no OpenSearch dependency. Invoked by `mapToMla` in
|
|
10
9
|
// `service/address-service.js` when a G-NAF address has NUMBER_LAST set.
|
|
11
|
-
//
|
|
12
|
-
//
|
|
10
|
+
//
|
|
11
|
+
// For a G-NAF range like `103-107 GAZE RD` (NUMBER_FIRST=103, NUMBER_LAST=107),
|
|
12
|
+
// emit exactly two aliases — the first and last endpoints — and nothing else.
|
|
13
|
+
// Mid-range numbers (104, 105, 106) do NOT match the range document:
|
|
14
|
+
//
|
|
15
|
+
// - Even-indexed mid-range numbers (104, 106) typically belong to properties
|
|
16
|
+
// on the opposite side of the street under Australian addressing convention.
|
|
17
|
+
// - Odd-indexed mid-range numbers (105) could be separate properties the
|
|
18
|
+
// range record absorbed, or a single contiguous frontage — G-NAF does not
|
|
19
|
+
// tell us which. Returning a range doc for a mid-range query would be a
|
|
20
|
+
// false positive either way.
|
|
21
|
+
//
|
|
22
|
+
// See ADR 028 and P015 / #367 reporter comments 2022-06-24 (`138-144`) and
|
|
23
|
+
// 2022-07-10 (`225-245`). The earlier full-interpolation approach from ADR 026
|
|
24
|
+
// shipped in v2.3.0 produced these false positives and is superseded.
|
|
13
25
|
|
|
14
|
-
const SPAN_CAP = exports.SPAN_CAP = 20;
|
|
15
26
|
function expandRangeAliases(first, last, streetPart, localityPart) {
|
|
16
27
|
if (!Number.isInteger(first) || !Number.isInteger(last)) return [];
|
|
17
28
|
if (first <= 0 || last <= 0) return [];
|
|
18
29
|
if (first >= last) return [];
|
|
19
|
-
|
|
20
|
-
const aliases = [];
|
|
21
|
-
for (let n = first; n <= last; n++) {
|
|
22
|
-
aliases.push(`${n} ${streetPart}, ${localityPart}`);
|
|
23
|
-
}
|
|
24
|
-
return aliases;
|
|
30
|
+
return [`${first} ${streetPart}, ${localityPart}`, `${last} ${streetPart}, ${localityPart}`];
|
|
25
31
|
}
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mountainpass/addressr",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "Australian Address Validation, Search and Autocomplete",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mountain Pass",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"packageManager": "npm@10.9.4",
|
|
19
19
|
"config": {
|
|
20
20
|
"localport": "6060",
|
|
21
|
-
"SEARCH_IMAGE": "opensearchproject/opensearch:
|
|
21
|
+
"SEARCH_IMAGE": "opensearchproject/opensearch:2.19.5",
|
|
22
|
+
"SEARCH_IMAGE_1_3_20": "opensearchproject/opensearch:1.3.20",
|
|
23
|
+
"SEARCH_IMAGE_2_19": "opensearchproject/opensearch:2.19.5"
|
|
22
24
|
},
|
|
23
25
|
"scripts": {
|
|
24
26
|
"gen-install-cmd": "echo \"#!/bin/sh\n\nnpm install -g ${npm_package_name}@${npm_package_version}\" > install.sh",
|
|
@@ -28,7 +30,11 @@
|
|
|
28
30
|
"turbo:ci:version": "turbo run ci:version",
|
|
29
31
|
"turbo:ci:publish": "turbo run ci:publish",
|
|
30
32
|
"pull:open-search": "docker pull ${npm_package_config_SEARCH_IMAGE}",
|
|
31
|
-
"start:open-search": "docker run -p 9200:9200 -p 9300:9300 -e \"ES_JAVA_OPTS=-Xms1g -Xmx1g\" -e \"discovery.type=single-node\" -e \"plugins.security.disabled=true\" \"${npm_package_config_SEARCH_IMAGE}\"",
|
|
33
|
+
"start:open-search": "docker run -p 9200:9200 -p 9300:9300 -e \"ES_JAVA_OPTS=-Xms1g -Xmx1g\" -e \"discovery.type=single-node\" -e \"plugins.security.disabled=true\" -e \"DISABLE_INSTALL_DEMO_CONFIG=true\" \"${npm_package_config_SEARCH_IMAGE}\"",
|
|
34
|
+
"pull:open-search:1.3.20": "docker pull ${npm_package_config_SEARCH_IMAGE_1_3_20}",
|
|
35
|
+
"start:open-search:1.3.20": "docker run -p 9200:9200 -p 9300:9300 -e \"ES_JAVA_OPTS=-Xms1g -Xmx1g\" -e \"discovery.type=single-node\" -e \"plugins.security.disabled=true\" -e \"DISABLE_INSTALL_DEMO_CONFIG=true\" \"${npm_package_config_SEARCH_IMAGE_1_3_20}\"",
|
|
36
|
+
"pull:open-search:2.19": "docker pull ${npm_package_config_SEARCH_IMAGE_2_19}",
|
|
37
|
+
"start:open-search:2.19": "docker run -p 9200:9200 -p 9300:9300 -e \"ES_JAVA_OPTS=-Xms1g -Xmx1g\" -e \"discovery.type=single-node\" -e \"plugins.security.disabled=true\" -e \"DISABLE_INSTALL_DEMO_CONFIG=true\" \"${npm_package_config_SEARCH_IMAGE_2_19}\"",
|
|
32
38
|
"hmm": "echo mountainpass-addressr-${npm_package_version}.tgz",
|
|
33
39
|
"requirements-check": "scripts/check-version.js",
|
|
34
40
|
"postinstall": "npm run requirements-check",
|
|
@@ -133,7 +139,6 @@
|
|
|
133
139
|
"ci:publish": "[ \"$CI\" = true ] && changeset publish || echo \"Dry run: changeset publish\"",
|
|
134
140
|
"push:watch": "bash scripts/push-and-watch.sh",
|
|
135
141
|
"release:watch": "bash scripts/release-watch.sh",
|
|
136
|
-
"test:hooks": "bats .claude/hooks/test/",
|
|
137
142
|
"prepare": "husky"
|
|
138
143
|
},
|
|
139
144
|
"bin": {
|
|
@@ -205,7 +210,6 @@
|
|
|
205
210
|
"@istanbuljs/nyc-config-babel": "^3.0.0",
|
|
206
211
|
"@mountainpass/waychaser": "^5.0.50",
|
|
207
212
|
"babel-plugin-istanbul": "^7.0.1",
|
|
208
|
-
"bats": "^1.13.0",
|
|
209
213
|
"chai": "^4.2.0",
|
|
210
214
|
"dry-aged-deps": "^2.6.0",
|
|
211
215
|
"eslint": "^9.39.4",
|