diff --git a/elasticsearch.yml b/elasticsearch.yml index e495d6f2f..dd1c4c37e 100644 --- a/elasticsearch.yml +++ b/elasticsearch.yml @@ -3,7 +3,6 @@ production: &default content_index_names: ["government"] govuk_index_name: "govuk" auxiliary_index_names: ["page-traffic", "metasearch"] - registry_index: "government" metasearch_index_name: "metasearch" page_traffic_index_name: "page-traffic" popularity_rank_offset: 10 @@ -21,7 +20,6 @@ test: content_index_names: ["government_test"] govuk_index_name: "govuk_test" auxiliary_index_names: ["page-traffic_test", "metasearch_test"] - registry_index: "government_test" metasearch_index_name: "metasearch_test" page_traffic_index_name: "page-traffic_test" popularity_rank_offset: 10 diff --git a/lib/search/presenters/entity_expander.rb b/lib/search/presenters/entity_expander.rb index 853c22541..efac78f40 100644 --- a/lib/search/presenters/entity_expander.rb +++ b/lib/search/presenters/entity_expander.rb @@ -31,10 +31,8 @@ def initialize(registry_name, new_field_name: nil) end MAPPINGS = [ - Mapping.new(:document_series), Mapping.new(:document_collections), Mapping.new(:organisations), - Mapping.new(:policy_areas), Mapping.new(:world_locations), Mapping.new(:people), Mapping.new(:roles), diff --git a/lib/search/registries.rb b/lib/search/registries.rb index 897e9d3bc..7f8e47cc9 100644 --- a/lib/search/registries.rb +++ b/lib/search/registries.rb @@ -8,16 +8,8 @@ def as_hash @as_hash ||= { organisations:, organisation_content_ids: organisations, - - # Whitehall has a thing called `topic`, which is being renamed to "policy - # area", because there already are seven things called "topic". Until - # Whitehall publishes the policy areas with format "policy_area" rather - # than "topic", we will expand `policy_areas` with data from documents - # with format `topic`. - policy_areas: registry_for_document_format("topic"), - document_series: registry_for_document_format("document_series"), - document_collections: registry_for_document_format("document_collection"), - world_locations: registry_for_document_format("world_location"), + document_collections: govuk_registry_for_document_format("document_collection"), + world_locations: govuk_registry_for_document_format("world_location"), people: govuk_registry_for_document_format("person"), roles: govuk_registry_for_document_format("ministerial_role"), } @@ -62,14 +54,6 @@ def govuk_index search_server.index_for_search([SearchConfig.govuk_index_name]) end - def registry_for_document_format(format) - BaseRegistry.new(index, field_definitions, format) - end - - def index - search_server.index_for_search([SearchConfig.registry_index]) - end - def field_definitions @field_definitions ||= search_server.schema.field_definitions end diff --git a/lib/search_config.rb b/lib/search_config.rb index 703fb9471..766f66a55 100644 --- a/lib/search_config.rb +++ b/lib/search_config.rb @@ -3,7 +3,6 @@ class << self attr_writer :instance %w[ - registry_index metasearch_index_name popularity_rank_offset auxiliary_index_names diff --git a/lib/tasks/report_inconsistent_aggregate_values.rake b/lib/tasks/report_inconsistent_aggregate_values.rake index 2969dfa44..e5288439d 100644 --- a/lib/tasks/report_inconsistent_aggregate_values.rake +++ b/lib/tasks/report_inconsistent_aggregate_values.rake @@ -9,10 +9,8 @@ task :report_inconsistent_aggregate_values do # Same as in `lib/search/presenters/entity_expander.rb` minus # the content_id mappings which are not valid aggregate fields. aggregates = %w[ - document_series document_collections organisations - policy_areas world_locations people ] diff --git a/spec/unit/result_set_presenter_spec.rb b/spec/unit/result_set_presenter_spec.rb index 9e7899aa4..6321500ba 100644 --- a/spec/unit/result_set_presenter_spec.rb +++ b/spec/unit/result_set_presenter_spec.rb @@ -32,7 +32,7 @@ def sample_docs "_source" => { "title" => "Dairy farming and schemes", "link" => "/dairy-farming-and-schemes", - "policy_areas" => %w[farming], + "document_collections" => %w[farming], }, }] end @@ -157,9 +157,9 @@ def search_presenter(options) context "results with a registry" do before do - policy_area_registry = { + document_collections_registry = { "farming" => { - "link" => "/government/topics/farming", + "link" => "/government/collections/farming", "title" => "Farming", }, } @@ -167,11 +167,11 @@ def search_presenter(options) @output = described_class.new( search_params: Search::QueryParameters.new( start: 0, - return_fields: %w[policy_areas], + return_fields: %w[document_collections], aggregate_name: :aggregates, ), es_response: sample_es_response, - registries: { policy_areas: policy_area_registry }, + registries: { document_collections: document_collections_registry }, ).present end @@ -208,10 +208,10 @@ def search_presenter(options) it "have the expanded topic" do result = @output[:results][2] expect([{ - "link" => "/government/topics/farming", + "link" => "/government/collections/farming", "title" => "Farming", "slug" => "farming", - }]).to eq result["policy_areas"] + }]).to eq result["document_collections"] end end end