From 8922d0d597bdb4ec44639b5a44cc467e3a444095 Mon Sep 17 00:00:00 2001 From: Laura Ghiorghisor Date: Wed, 7 Aug 2024 12:38:45 +0100 Subject: [PATCH 1/3] Add mock finder - changed the type of facet 2 to searchable_text - as we changed in the publisher --- config/govuk_index/mapped_document_types.yaml | 1 + .../elasticsearch_types/mock_spike_finder_document.json | 6 ++++++ config/schema/field_definitions.json | 7 +++++++ config/schema/indexes/govuk.json | 1 + lib/govuk_index/presenters/elasticsearch_presenter.rb | 2 ++ lib/govuk_index/presenters/specialist_presenter.rb | 2 ++ 6 files changed, 19 insertions(+) create mode 100644 config/schema/elasticsearch_types/mock_spike_finder_document.json diff --git a/config/govuk_index/mapped_document_types.yaml b/config/govuk_index/mapped_document_types.yaml index 6d680cb84..bc18fff9e 100644 --- a/config/govuk_index/mapped_document_types.yaml +++ b/config/govuk_index/mapped_document_types.yaml @@ -42,6 +42,7 @@ marine_equipment_approved_recommendation: marine_equipment_approved_recommendati marine_notice: marine_notice # Specialist Publisher medical_safety_alert: medical_safety_alert # Specialist Publisher ministerial_role: edition +mock_spike_finder_document: mock_spike_finder_document # Specialist Publisher news_story: edition person: person place: edition diff --git a/config/schema/elasticsearch_types/mock_spike_finder_document.json b/config/schema/elasticsearch_types/mock_spike_finder_document.json new file mode 100644 index 000000000..9ddf0eaae --- /dev/null +++ b/config/schema/elasticsearch_types/mock_spike_finder_document.json @@ -0,0 +1,6 @@ +{ + "fields": [ + "mock_spike_finder_document_facet_one", + "mock_spike_finder_document_facet_two" + ] +} diff --git a/config/schema/field_definitions.json b/config/schema/field_definitions.json index 8d2214ed6..04b19c403 100644 --- a/config/schema/field_definitions.json +++ b/config/schema/field_definitions.json @@ -1104,5 +1104,12 @@ }, "veterans_support_organisation_region_wales": { "type": "identifiers" + }, + + "mock_spike_finder_document_facet_one": { + "type": "identifiers" + }, + "mock_spike_finder_document_facet_two": { + "type": "searchable_text" } } \ No newline at end of file diff --git a/config/schema/indexes/govuk.json b/config/schema/indexes/govuk.json index 471c6c73f..0b60a64e0 100644 --- a/config/schema/indexes/govuk.json +++ b/config/schema/indexes/govuk.json @@ -29,6 +29,7 @@ "marine_equipment_approved_recommendation", "marine_notice", "medical_safety_alert", + "mock_spike_finder_document", "person", "policy", "product_safety_alert_report_recall", diff --git a/lib/govuk_index/presenters/elasticsearch_presenter.rb b/lib/govuk_index/presenters/elasticsearch_presenter.rb index cf536a092..ebe815f7a 100644 --- a/lib/govuk_index/presenters/elasticsearch_presenter.rb +++ b/lib/govuk_index/presenters/elasticsearch_presenter.rb @@ -118,6 +118,8 @@ def document marine_notice_vessel_type: specialist.marine_notice_vessel_type, market_sector: specialist.market_sector, medical_specialism: specialist.medical_specialism, + mock_spike_finder_document_facet_one: specialist.mock_spike_finder_document_facet_one, + mock_spike_finder_document_facet_two: specialist.mock_spike_finder_document_facet_two, opened_date: specialist.opened_date, organisation_content_ids: expanded_links.organisation_content_ids, organisations: expanded_links.organisations, diff --git a/lib/govuk_index/presenters/specialist_presenter.rb b/lib/govuk_index/presenters/specialist_presenter.rb index 0a0c50fa7..68fc0838b 100644 --- a/lib/govuk_index/presenters/specialist_presenter.rb +++ b/lib/govuk_index/presenters/specialist_presenter.rb @@ -83,6 +83,8 @@ class SpecialistPresenter delegate_to_payload :marine_notice_vessel_type delegate_to_payload :market_sector delegate_to_payload :medical_specialism + delegate_to_payload :mock_spike_finder_document_facet_one, convert_to_array: true + delegate_to_payload :mock_spike_finder_document_facet_two delegate_to_payload :opened_date delegate_to_payload :outcome_type delegate_to_payload :payment_types From c76c6d5aaea8f923de2113d35ff5bdccfb12b33c Mon Sep 17 00:00:00 2001 From: Laura Ghiorghisor Date: Thu, 8 Aug 2024 12:13:26 +0100 Subject: [PATCH 2/3] Add mock finder to migrated formats --- config/govuk_index/migrated_formats.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/govuk_index/migrated_formats.yaml b/config/govuk_index/migrated_formats.yaml index f250f308b..c18e5f0c7 100644 --- a/config/govuk_index/migrated_formats.yaml +++ b/config/govuk_index/migrated_formats.yaml @@ -48,6 +48,7 @@ migrated: - marine_equipment_approved_recommendation - marine_notice - medical_safety_alert +- mock_spike_finder_document - product_safety_alert_report_recall - protected_food_drink_name - raib_report From aab022be4155addb6c62a36f698760f7cc93288e Mon Sep 17 00:00:00 2001 From: Minno Dang Date: Fri, 23 Aug 2024 09:49:03 +0100 Subject: [PATCH 3/3] Restore expanded search results Unfortunately this introduces extremely strange behaviour - we cannot reliably remove this at this point --- .../mock_spike_finder_document.json | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/config/schema/elasticsearch_types/mock_spike_finder_document.json b/config/schema/elasticsearch_types/mock_spike_finder_document.json index 9ddf0eaae..24bc5b707 100644 --- a/config/schema/elasticsearch_types/mock_spike_finder_document.json +++ b/config/schema/elasticsearch_types/mock_spike_finder_document.json @@ -2,5 +2,25 @@ "fields": [ "mock_spike_finder_document_facet_one", "mock_spike_finder_document_facet_two" - ] + ], + "expanded_search_result_fields": { + "mock_spike_finder_document_facet_one": [ + { + "label": "Facet one value one", + "value": "facet-one-value-one" + },{ + "label": "Facet one value two", + "value": "facet-one-value-two" + } + ], + "mock_spike_finder_document_facet_two": [ + { + "label": "Facet two value one", + "value": "facet-two-value-one" + },{ + "label": "Facet two value two", + "value": "facet-two-value-two" + } + ] + } }