Skip to content

Commit

Permalink
Merge pull request #138 from alphagov/title-desc-content
Browse files Browse the repository at this point in the history
Add title and description to indexable content
  • Loading branch information
csutter authored Dec 7, 2023
2 parents 990d5c2 + 7483d38 commit bd3960a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
7 changes: 7 additions & 0 deletions app/models/concerns/publishing_api/content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ module PublishingApi
module Content
# All the possible keys in the message hash that can contain the primary unstructured document
# content that we want to index, represented as JsonPath path strings.
#
# Note that this also indexes some things that are in metadata attributes (e.g. title,
# description) as it seems that the engine is better at picking up on them if they are in the
# unstructured content.
INDEXABLE_CONTENT_VALUES_JSON_PATHS = %w[
$.title
$.description

$.details.acronym
$.details.attachments[*]['title','isbn','unique_reference','command_paper_number','hoc_paper_number']
$.details.body
Expand Down
21 changes: 13 additions & 8 deletions spec/integration/document_synchronization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
part_of_taxonomy_tree: %w[37d0fa26-abed-4c74-8835-b3b51ae1c8b2],
locale: "en",
},
content: a_string_starting_with("<div class=\"govspeak\"><p>The UK was represented remotely"),
content: a_string_including("<div class=\"govspeak\"><p>The UK was represented remotely"),
payload_version: 12_345,
)
end
Expand Down Expand Up @@ -87,7 +87,7 @@
},
],
},
content: a_string_starting_with("<h1>Warnings and insurance</h1>\n<p>The Foreign"),
content: a_string_including("<h1>Warnings and insurance</h1>\n<p>The Foreign"),
payload_version: 12_345,
)
end
Expand Down Expand Up @@ -117,7 +117,7 @@
],
locale: "en",
},
content: a_string_starting_with("<div class=\"govspeak\"><p>In the UEFA Champions"),
content: a_string_including("<div class=\"govspeak\"><p>In the UEFA Champions"),
payload_version: 12_345,
)
end
Expand All @@ -141,7 +141,7 @@
content_purpose_supergroup: "guidance_and_regulation",
locale: "en",
},
content: a_string_matching(/\A<h2 id="section-6-1">6\.1\. Structure.+<\/table>\n\n\z/m),
content: a_string_matching(/<h2 id="section-6-1">6\.1\. Structure.+<\/table>\n\n/m),
payload_version: 12_345,
)
end
Expand All @@ -166,7 +166,7 @@
content_purpose_supergroup: "other",
locale: "en",
},
content: a_string_starting_with("LAA\n<div class=\"govspeak\"><p>We provide civil"),
content: a_string_including("LAA\n<div class=\"govspeak\"><p>We provide civil"),
payload_version: 12_345,
)
end
Expand All @@ -192,7 +192,9 @@
part_of_taxonomy_tree: %w[f3caf326-fe33-410f-b7f4-553f4011c81e],
locale: "en",
},
content: a_string_starting_with(<<~TEXT.chomp),
content: a_string_including(<<~TEXT.chomp),
Directgov 2010 and beyond: revolution not evolution, a report by Martha Lane Fox
A report from the Digital Champion Martha Lane Fox with recommendations for the future of Directgov.
Directgov 2010 and Beyond: Revolution Not Evolution - Letter from Martha Lane Fox to Francis Maude
Francis Maude's reply to Martha Lane Fox's letter
Directgov Strategic Review - Executive Summary
Expand Down Expand Up @@ -221,7 +223,10 @@
content_purpose_supergroup: "other",
locale: "en",
},
content: "",
content: <<~TEXT.chomp,
UK help and services in Switzerland
Services if you're visiting, studying, working or living in Switzerland. Includes information about trading with and doing business in the UK and Switzerland, and your rights after the UK’s exit from the EU.
TEXT
payload_version: 12_345,
)
end
Expand All @@ -245,7 +250,7 @@
content_purpose_supergroup: "other",
locale: "en",
},
content: "Brighton & Hove City Council",
content: a_string_including("Brighton & Hove City Council"),
payload_version: 17,
)
end
Expand Down

0 comments on commit bd3960a

Please sign in to comment.