diff --git a/internal/etl/testdata/config.yaml b/internal/etl/testdata/config.yaml
index f484a2a..147b78a 100644
--- a/internal/etl/testdata/config.yaml
+++ b/internal/etl/testdata/config.yaml
@@ -24,6 +24,7 @@ collections:
displayNameTemplate: "{{ .component_thoroughfarename }} - {{ .component_addressareaname | firstupper }}"
etl:
suggestTemplates:
+ - "{{ .component_thoroughfarename }} {{ .component_addressareaname }}"
- "{{ .component_thoroughfarename }} {{ .component_addressareaname }}"
- "{{ .component_thoroughfarename }}, {{ .component_postaldescriptor }} {{ .component_addressareaname }}"
ogcCollections:
diff --git a/internal/etl/transform/transform.go b/internal/etl/transform/transform.go
index a00eae9..e5fdfb6 100644
--- a/internal/etl/transform/transform.go
+++ b/internal/etl/transform/transform.go
@@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"fmt"
+ "slices"
"strconv"
"strings"
"text/template"
@@ -64,6 +65,8 @@ func (t Transformer) Transform(records []RawRecord, collection config.GeoSpatial
suggestions = append(suggestions, suggestion)
}
}
+ suggestions = slices.Compact(suggestions)
+
bbox, err := r.transformBbox()
if err != nil {
return nil, err
diff --git a/internal/search/datasources/postgres/postgres.go b/internal/search/datasources/postgres/postgres.go
index 2a26705..ebfadd2 100644
--- a/internal/search/datasources/postgres/postgres.go
+++ b/internal/search/datasources/postgres/postgres.go
@@ -88,7 +88,7 @@ func makeSearchQuery(index string, srid d.SRID) string {
from (
select display_name, feature_id, collection_id, collection_version, geometry_type, bbox,
ts_rank_cd(ts, (select query from query), 1) as rank,
- ts_headline('simple', display_name, (select query from query)) as highlighted_text
+ ts_headline('simple', suggest, (select query from query)) as highlighted_text
from %[1]s
where ts @@ (select query from query) and (collection_id, collection_version) in (
-- make a virtual table by creating tuples from the provided arrays.
diff --git a/internal/search/testdata/expected-search-den-building-collection-wgs84.json b/internal/search/testdata/expected-search-den-building-collection-wgs84.json
index e407111..41b708e 100644
--- a/internal/search/testdata/expected-search-den-building-collection-wgs84.json
+++ b/internal/search/testdata/expected-search-den-building-collection-wgs84.json
@@ -17,7 +17,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 1",
- "highlight": "Abbewaal - Den Burg 1",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/51?f=json",
"score": 0.07213475555181503
},
@@ -65,7 +65,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 1",
- "highlight": "Abbewaal - Den Burg 1",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/52?f=json",
"score": 0.07213475555181503
},
@@ -113,7 +113,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/32183?f=json",
"score": 0.07213475555181503
},
@@ -161,7 +161,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/53?f=json",
"score": 0.07213475555181503
},
@@ -209,7 +209,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/32184?f=json",
"score": 0.07213475555181503
},
@@ -257,7 +257,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/54?f=json",
"score": 0.07213475555181503
},
@@ -305,7 +305,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 11",
- "highlight": "Abbewaal - Den Burg 11",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/22549?f=json",
"score": 0.07213475555181503
},
@@ -353,7 +353,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 13",
- "highlight": "Abbewaal - Den Burg 13",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/56?f=json",
"score": 0.07213475555181503
},
@@ -401,7 +401,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 13",
- "highlight": "Abbewaal - Den Burg 13",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/55?f=json",
"score": 0.07213475555181503
},
@@ -449,7 +449,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 15",
- "highlight": "Abbewaal - Den Burg 15",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/57?f=json",
"score": 0.07213475555181503
},
diff --git a/internal/search/testdata/expected-search-den-multiple-collection-single-output-wgs84.json b/internal/search/testdata/expected-search-den-multiple-collection-single-output-wgs84.json
index 4a0f4fb..7bea259 100644
--- a/internal/search/testdata/expected-search-den-multiple-collection-single-output-wgs84.json
+++ b/internal/search/testdata/expected-search-den-multiple-collection-single-output-wgs84.json
@@ -17,7 +17,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 1",
- "highlight": "Abbewaal - Den Burg 1",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/51?f=json",
"score": 0.07213475555181503
},
@@ -65,7 +65,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 1",
- "highlight": "Abbewaal - Den Burg 1",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/52?f=json",
"score": 0.07213475555181503
},
@@ -113,7 +113,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/32183?f=json",
"score": 0.07213475555181503
},
@@ -161,7 +161,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/53?f=json",
"score": 0.07213475555181503
},
@@ -209,7 +209,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/32184?f=json",
"score": 0.07213475555181503
},
@@ -257,7 +257,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/54?f=json",
"score": 0.07213475555181503
},
@@ -305,7 +305,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 11",
- "highlight": "Abbewaal - Den Burg 11",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/22549?f=json",
"score": 0.07213475555181503
},
@@ -353,7 +353,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 13",
- "highlight": "Abbewaal - Den Burg 13",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/56?f=json",
"score": 0.07213475555181503
},
@@ -401,7 +401,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 13",
- "highlight": "Abbewaal - Den Burg 13",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/55?f=json",
"score": 0.07213475555181503
},
@@ -449,7 +449,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 15",
- "highlight": "Abbewaal - Den Burg 15",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/57?f=json",
"score": 0.07213475555181503
},
@@ -497,7 +497,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 15",
- "highlight": "Abbewaal - Den Burg 15",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/58?f=json",
"score": 0.07213475555181503
},
@@ -545,7 +545,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 17",
- "highlight": "Abbewaal - Den Burg 17",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/16128?f=json",
"score": 0.07213475555181503
},
@@ -593,7 +593,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 19",
- "highlight": "Abbewaal - Den Burg 19",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/59?f=json",
"score": 0.07213475555181503
},
@@ -641,7 +641,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 19 A",
- "highlight": "Abbewaal - Den Burg 19 A",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/23322?f=json",
"score": 0.07213475555181503
},
@@ -689,7 +689,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 2",
- "highlight": "Abbewaal - Den Burg 2",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/16129?f=json",
"score": 0.07213475555181503
},
@@ -737,7 +737,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 2",
- "highlight": "Abbewaal - Den Burg 2",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/16130?f=json",
"score": 0.07213475555181503
},
@@ -785,7 +785,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 21",
- "highlight": "Abbewaal - Den Burg 21",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/60?f=json",
"score": 0.07213475555181503
},
@@ -833,7 +833,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 21 A",
- "highlight": "Abbewaal - Den Burg 21 A",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/61?f=json",
"score": 0.07213475555181503
},
@@ -881,7 +881,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 23",
- "highlight": "Abbewaal - Den Burg 23",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/16132?f=json",
"score": 0.07213475555181503
},
@@ -929,7 +929,7 @@
"collectionId": "buildings",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 23",
- "highlight": "Abbewaal - Den Burg 23",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/buildings/items/16131?f=json",
"score": 0.07213475555181503
},
diff --git a/internal/search/testdata/expected-search-den-single-collection-rd.json b/internal/search/testdata/expected-search-den-single-collection-rd.json
index 69709ce..9b248f3 100644
--- a/internal/search/testdata/expected-search-den-single-collection-rd.json
+++ b/internal/search/testdata/expected-search-den-single-collection-rd.json
@@ -17,7 +17,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 1",
- "highlight": "Abbewaal - Den Burg 1",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/51?f=json",
"score": 0.07213475555181503
},
@@ -65,7 +65,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 1",
- "highlight": "Abbewaal - Den Burg 1",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/52?f=json",
"score": 0.07213475555181503
},
@@ -113,7 +113,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/32183?f=json",
"score": 0.07213475555181503
},
@@ -161,7 +161,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/53?f=json",
"score": 0.07213475555181503
},
@@ -209,7 +209,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/32184?f=json",
"score": 0.07213475555181503
},
@@ -257,7 +257,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/54?f=json",
"score": 0.07213475555181503
},
@@ -305,7 +305,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 11",
- "highlight": "Abbewaal - Den Burg 11",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/22549?f=json",
"score": 0.07213475555181503
},
@@ -353,7 +353,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 13",
- "highlight": "Abbewaal - Den Burg 13",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/56?f=json",
"score": 0.07213475555181503
},
@@ -401,7 +401,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 13",
- "highlight": "Abbewaal - Den Burg 13",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/55?f=json",
"score": 0.07213475555181503
},
@@ -449,7 +449,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 15",
- "highlight": "Abbewaal - Den Burg 15",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/57?f=json",
"score": 0.07213475555181503
},
diff --git a/internal/search/testdata/expected-search-den-single-collection-wgs84.json b/internal/search/testdata/expected-search-den-single-collection-wgs84.json
index 4db63b7..97a02a1 100644
--- a/internal/search/testdata/expected-search-den-single-collection-wgs84.json
+++ b/internal/search/testdata/expected-search-den-single-collection-wgs84.json
@@ -17,7 +17,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 1",
- "highlight": "Abbewaal - Den Burg 1",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/51?f=json",
"score": 0.07213475555181503
},
@@ -65,7 +65,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 1",
- "highlight": "Abbewaal - Den Burg 1",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/52?f=json",
"score": 0.07213475555181503
},
@@ -113,7 +113,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/32183?f=json",
"score": 0.07213475555181503
},
@@ -161,7 +161,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/53?f=json",
"score": 0.07213475555181503
},
@@ -209,7 +209,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/32184?f=json",
"score": 0.07213475555181503
},
@@ -257,7 +257,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 10",
- "highlight": "Abbewaal - Den Burg 10",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/54?f=json",
"score": 0.07213475555181503
},
@@ -305,7 +305,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 11",
- "highlight": "Abbewaal - Den Burg 11",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/22549?f=json",
"score": 0.07213475555181503
},
@@ -353,7 +353,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 13",
- "highlight": "Abbewaal - Den Burg 13",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/56?f=json",
"score": 0.07213475555181503
},
@@ -401,7 +401,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 13",
- "highlight": "Abbewaal - Den Burg 13",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/55?f=json",
"score": 0.07213475555181503
},
@@ -449,7 +449,7 @@
"collectionId": "addresses",
"collectionVersion": "1",
"displayName": "Abbewaal - Den Burg 15",
- "highlight": "Abbewaal - Den Burg 15",
+ "highlight": "abbewaal den burg",
"href": "https://example.com/ogc/v1/collections/addresses/items/57?f=json",
"score": 0.07213475555181503
},