From e362bd10f7a7f7e51b84c760d1e34fd064777873 Mon Sep 17 00:00:00 2001 From: Marcel Clausen Date: Fri, 6 Dec 2024 17:24:14 +0100 Subject: [PATCH 1/4] PB-1167: the query text for fuzzy search will be built without * charachters, that's why we have to auomtaically expand keywords on index generation --- conf/search.conf.part | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/search.conf.part b/conf/search.conf.part index 8c28ece..fe9a2da 100644 --- a/conf/search.conf.part +++ b/conf/search.conf.part @@ -445,6 +445,7 @@ index address_metaphone: zipcode source = src_address path = /var/lib/sphinxsearch/data/index/address_metaphone preopen = 0 + expand_keywords = 1 } # only create on demand From 8d97b5dad9c52fc3b64d15aa5fb12f4fec1b35c9 Mon Sep 17 00:00:00 2001 From: Marcel Clausen Date: Fri, 6 Dec 2024 22:48:17 +0100 Subject: [PATCH 2/4] PB-1167: fix wrong queries for the ci --- conf/lubis.conf.part | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/conf/lubis.conf.part b/conf/lubis.conf.part index 842c8b2..f1ac0dd 100644 --- a/conf/lubis.conf.part +++ b/conf/lubis.conf.part @@ -43,9 +43,9 @@ source src_ch_swisstopo_lubis_luftbilder_farbe : def_searchable_features_with_ye sql_db = lubis_${DBSTAGING} sql_query = \ SELECT row_number() OVER(ORDER BY ebkey asc) as id \ - , concat(flugdatum, ' ', bildnummer, ' (', concat_ws(', ', ort, ebkey), ')' ) as label \ + , concat(flugdatum, ' ', feature_id, ' (', concat_ws(', ', ebkey), ')' ) as label \ , 'feature' as origin \ - , remove_accents(concat_ws(' ', ebkey, ort, ebkey_old)) as detail \ + , remove_accents(concat_ws(' ', ebkey, ebkey_old)) as detail \ , 'ch.swisstopo.lubis-luftbilder_farbe' as layer \ , bgdi_quadindex as geom_quadindex \ , st_y(st_transform(st_centroid(the_geom),4326)) as lat \ @@ -62,9 +62,9 @@ source src_ch_swisstopo_lubis_luftbilder_schwarzweiss: def_searchable_features_w sql_db = lubis_${DBSTAGING} sql_query = \ SELECT row_number() OVER(ORDER BY ebkey asc) as id \ - , concat(flugdatum, ' ', bildnummer, ' (', concat_ws(', ', ort, ebkey), ')' ) as label \ + , concat(flugdatum, ' ', feature_id, ' (', concat_ws(', ', ebkey), ')' ) as label \ , 'feature' as origin \ - , remove_accents(concat_ws(' ', ebkey, ort, ebkey_old)) as detail \ + , remove_accents(concat_ws(' ', ebkey, ebkey_old)) as detail \ , 'ch.swisstopo.lubis-luftbilder_schwarzweiss' as layer \ , bgdi_quadindex as geom_quadindex \ , st_y(st_transform(st_centroid(the_geom),4326)) as lat \ @@ -81,9 +81,9 @@ source src_ch_swisstopo_lubis_luftbilder_infrarot: def_searchable_features_with_ sql_db = lubis_${DBSTAGING} sql_query = \ SELECT row_number() OVER(ORDER BY ebkey asc) as id \ - , concat(flugdatum, ' ', bildnummer, ' (', concat_ws(', ', ort, ebkey, ebkey_old), ')' ) as label \ + , concat(flugdatum, ' ', feature_id, ' (', concat_ws(', ', ebkey, ebkey_old), ')' ) as label \ , 'feature' as origin \ - , remove_accents(concat_ws(' ', ebkey, ort)) as detail \ + , remove_accents(ebkey) as detail \ , 'ch.swisstopo.lubis-luftbilder_infrarot' as layer \ , bgdi_quadindex as geom_quadindex \ , st_y(st_transform(st_centroid(the_geom),4326)) as lat \ @@ -140,7 +140,7 @@ source src_ch_swisstopo_lubis_terrestrische_aufnahmen : def_searchable_features_ SELECT row_number() OVER(ORDER BY inventory_number asc) as id \ , lpad(bilder.inventory_number::text, 14, '0'::text) as label \ , 'feature' as origin \ - , remove_accents(concat_ws(' ', inventory_number, image_number, station, operate_name, year, inventarnummer_old)) as detail \ + , remove_accents(concat_ws(' ', inventory_number, station, operate_name, year, inventarnummer_old)) as detail \ , 'ch.swisstopo.lubis-terrestrische_aufnahmen' as layer \ , bgdi_quadindex as geom_quadindex \ , st_y(st_transform(st_centroid(the_geom),4326)) as lat \ From d7991cd6da24e6fa030ea10a168575148317b2bb Mon Sep 17 00:00:00 2001 From: Marcel Clausen Date: Mon, 9 Dec 2024 11:03:56 +0100 Subject: [PATCH 3/4] PB-1167: wordforms will be disabled in fuzzy index for better quorum match --- conf/search.conf.part | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/conf/search.conf.part b/conf/search.conf.part index fe9a2da..f588885 100644 --- a/conf/search.conf.part +++ b/conf/search.conf.part @@ -405,6 +405,7 @@ index district_metaphone : zipcode source = src_district path = /var/lib/sphinxsearch/data/index/district_metaphone preopen = 0 + wordforms = /dev/null } index kantone_metaphone : zipcode @@ -413,6 +414,7 @@ index kantone_metaphone : zipcode source = src_kantone path = /var/lib/sphinxsearch/data/index/kantone_metaphone preopen = 0 + wordforms = /dev/null } index gg25_metaphone : zipcode @@ -421,6 +423,7 @@ index gg25_metaphone : zipcode source = src_gg25 path = /var/lib/sphinxsearch/data/index/gg25_metaphone preopen = 0 + wordforms = /dev/null } index swissnames3d_metaphone : zipcode @@ -429,6 +432,7 @@ index swissnames3d_metaphone : zipcode source = src_swissnames3d path = /var/lib/sphinxsearch/data/index/swissnames3d_metaphone preopen = 0 + wordforms = /dev/null } index haltestellen_metaphone : zipcode @@ -437,6 +441,7 @@ index haltestellen_metaphone : zipcode source = src_haltestellen path = /var/lib/sphinxsearch/data/index/haltestellen_metaphone preopen = 0 + wordforms = /dev/null } index address_metaphone: zipcode @@ -445,7 +450,7 @@ index address_metaphone: zipcode source = src_address path = /var/lib/sphinxsearch/data/index/address_metaphone preopen = 0 - expand_keywords = 1 + wordforms = /dev/null } # only create on demand From a5e9c3b75b906add0c9394c27d6bd203d381f9a5 Mon Sep 17 00:00:00 2001 From: Marcel Clausen Date: Mon, 9 Dec 2024 14:12:57 +0100 Subject: [PATCH 4/4] PB-1167: enable automated wildcard expansion of keywords the fuzzy string search Text will be built without wildcards by the wsgi application. we have to enable automated wildcard expansion for infix matches in the index configuration --- conf/search.conf.part | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conf/search.conf.part b/conf/search.conf.part index f588885..bbc2bfc 100644 --- a/conf/search.conf.part +++ b/conf/search.conf.part @@ -406,6 +406,7 @@ index district_metaphone : zipcode path = /var/lib/sphinxsearch/data/index/district_metaphone preopen = 0 wordforms = /dev/null + expand_keywords = 1 } index kantone_metaphone : zipcode @@ -415,6 +416,7 @@ index kantone_metaphone : zipcode path = /var/lib/sphinxsearch/data/index/kantone_metaphone preopen = 0 wordforms = /dev/null + expand_keywords = 1 } index gg25_metaphone : zipcode @@ -424,6 +426,7 @@ index gg25_metaphone : zipcode path = /var/lib/sphinxsearch/data/index/gg25_metaphone preopen = 0 wordforms = /dev/null + expand_keywords = 1 } index swissnames3d_metaphone : zipcode @@ -433,6 +436,7 @@ index swissnames3d_metaphone : zipcode path = /var/lib/sphinxsearch/data/index/swissnames3d_metaphone preopen = 0 wordforms = /dev/null + expand_keywords = 1 } index haltestellen_metaphone : zipcode @@ -442,6 +446,7 @@ index haltestellen_metaphone : zipcode path = /var/lib/sphinxsearch/data/index/haltestellen_metaphone preopen = 0 wordforms = /dev/null + expand_keywords = 1 } index address_metaphone: zipcode @@ -451,6 +456,7 @@ index address_metaphone: zipcode path = /var/lib/sphinxsearch/data/index/address_metaphone preopen = 0 wordforms = /dev/null + expand_keywords = 1 } # only create on demand