Skip to content

Commit c2878a0

Browse files
committed
Patch: Error when no token + Maintenance items
1 parent 9fc68a2 commit c2878a0

File tree

13 files changed

+377
-265
lines changed

13 files changed

+377
-265
lines changed

README.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ The goal is to continue to refine and improve this code base on a regular basis.
2121

2222
### Improvement plan
2323

24-
To manage development activities related to this project, a standard internal issue tracking system used at Principal Publisher will be used. Also, regular touchpoints with the search vendor, as well as formal service requests entered through their portal, could also spark some development activities from a vendor perspective.
24+
To manage development activities related to this project, a standard internal issue tracking system used at Principal Publisher will be used. Also, regular touchpoints with the search vendor, as well as formal service requests entered through their portal, could spark development activities from the vendor's team.
2525

2626
Example of code contributions may be related to:
2727

2828
- development/configurations of AI-powered features and other innovations
2929
- bug fixes, accessibility and security improvements
3030
- project maintenance chores
3131

32-
For more details, please [consult full checklist of to do items](todo.md).
32+
For more details, please [consult the checklist of "to do" items](todo.md).
3333

3434
## Releases and API
3535

3636
All changes contributed through Pull requests will be packaged as releases. Releases are completed through the "Releases" tab in this GitHub repository; then, deployment to MWS follows the reguar release management cycle accordingly.
3737

38-
Each new verion of this project is defined based on an evaluaton of the impacts of changes against any formerly up-to-date LIVE Search UI implementation on Canada.ca. The scope constitutes of all files within the "dist" folder (distribution files), which are JavaScript scripts and CSS styles. Additionally, volume of usage for features can also be taken into consideration as part of the evaluation of impact on versioning. For example, an interactive feature from the Javascript which is known by certitude to have never been used in a production environment, wouldn't cause any breaking change if modified and therefore, wouldn't generate a major version.
38+
Each new verion of this project is defined based on an evaluaton of the impacts of changes against any formerly up-to-date LIVE Search UI implementation on Canada.ca. The scope constitutes of all files within the "dist" folder (distribution files), which are JavaScript scripts and CSS style sheets. Additionally, volume of usage for features can also be taken into consideration as part of the evaluation of impact on versioning. For example, an interactive feature from the Javascript which is known by certitude to have never been used in a production environment, wouldn't cause any breaking change if modified and therefore, wouldn't generate a major version necessarily.
3939

40-
Search UI follows [Semantic Versioning 2.0.0](https://semver.org/)
40+
Aside from the evaluation based on usage, Search UI follows [Semantic Versioning 2.0.0](https://semver.org/)
4141

4242
---
4343

@@ -120,6 +120,10 @@ They must be used within the `[data-gc-search]` attribute. See the **/test/src-e
120120
: Set the search behavior of the page as an advanced search. This is optional since it will detect automatically from the path of your page if it is advanced. If not determined, default is: `false`
121121
- `originLevel3`
122122
: Allows for mimicking a specific search page/context, such as the ESDC contextual search if you set it to: `/en/employment-social-development/search.html`; this value can be be relative or absolute and is used to differentiate and contextualize a search page from another both in terms of scoping the search results and in terms of knowledge base for machine learning-powered features. Default is set to the current page's absolute URL
123+
- `numberOfPages`
124+
: The number of pages to display in the pager. Default is 9
125+
- `automaticallyCorrectQuery`
126+
: Whether to automatically apply corrections for queries that would otherwise return no results. Default is false
123127

124128
#### Templates
125129

@@ -138,15 +142,15 @@ For example, to override the search results template, you would do something alo
138142
Template override should technically only be used on a few instances of the search pages. If all pages would benefit from a template override, then the recommended action would be to modify the default template HTML code at the source through a pull request.
139143

140144
- `sr-single`
141-
: Template for all search results individually
145+
: Template for all search results individually; your custom template MUST include an hyperlink with the class `result-link`, which SHOULD also include the data attribute `data-dtm-srchlnknm` for analytis tracking
142146
- `sr-nores`
143-
: For when there is no results to show
147+
: For when there is no results to show; your custom template MUST include a heading of level H2
144148
- `sr-error`
145-
: For when an error occurs in the communication between the search page and the search engine
149+
: For when an error occurs in the communication between the search page and the search engine; your custom template MUST include a heading of level H2
146150
- `sr-query-summary`
147-
: For the summary zone above the search results. Recommended to include an H2 tag for accessibility purposes
151+
: For the summary zone above the search results; your custom template MUST include a heading of level H2
148152
- `sr-noquery-summary`
149-
: For the summary zone above the search results on advanced search pages. Recommended to include an H2 tag for accessibility purposes
153+
: For the summary zone above the search results on advanced search pages; your custom template MUST include a heading of level H2
150154
- `sr-did-you-mean`
151155
: For the "Did you mean" suggestion section
152156
- `sr-pager-previous`
@@ -157,6 +161,8 @@ Template override should technically only be used on a few instances of the sear
157161
: For the next page button
158162
- `sr-pager-container`
159163
: For the wrapper of all pagniation button
164+
- `sr-qs-hint`
165+
: Message announced to screen reader to provide instructions on QS
160166

161167
As demonstrated in the example above, and by looking at the default templates, you'll notice that some variables can be used within the templates to be replaced by dynamic content coming from the search engine's API response.
162168

@@ -196,6 +202,10 @@ Here is the extensive list of what variables can be used in templates:
196202
: returns what the search engine considers a better search query in case a low amount or zero results show (based on criteria handled within the serach engine). To be used on Did you mean template
197203
- `page`
198204
: returns page number. To be used on Pagination template
205+
- `result.raw.disp_declared_type`
206+
: returns name of the declared type as defined in the meta data of the page (specific to News items)
207+
- `result.raw.description`
208+
: returns the meta description of the pages in the results; can be displayed instead of the default "matches excerpt".
199209

200210
#### Parameters
201211

@@ -218,7 +228,7 @@ Sometimes your search pages contain more than one input relevant to the search's
218228
- `dmn`
219229
: Search for search terms in input, only on a specific domain
220230
- `sort`
221-
: Sort search results based on different criteria. Options are: by relevance (default when undefined) or by date when parameter is set
231+
: Sort search results based on different criteria. Options are: by relevance (default when undefined) or by date when parameter is set to `descending` or `ascending`
222232
- `elctn_cat`
223233
: Used specifically for Elections Canada, to define a scope of search amongst their collection. See **/src/connector.js** to see all the options available
224234
- `site`
@@ -229,6 +239,12 @@ Sometimes your search pages contain more than one input relevant to the search's
229239
: Search , within documents of a certain file type. Options are: `application/pdf`, `ps`, `application/msword`, `application/vnd.ms-excel`, `application/vnd.ms-powerpoint`, `application/rtf`
230240
- `originLevel3`
231241
: Allows for mimicking a specific search page/context by setting its path through this URL parameter; this takes precedence over the configuration through data attribute
242+
- `startdate`
243+
: returns results that have a date meta data higher than or equal to the date provided
244+
- `enddate`
245+
: returns results that have a date meta data lower than or equal to the date provided
246+
- `declaredtype`
247+
: returns results based on the type provided, mapped to disp_declared_type behind the scenes (specific to News items)
232248

233249
### Other
234250

index.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
---
22
title: Search user interface (UI) with Headless
33
lang: en
4-
dateModified: 2025-08-04
4+
dateModified: 2025-11-03
55
---
66

77
<p class="lead">This is a demo site for the GC Search UI.</p>
88

9-
<h2 id="test">Test pages</h2>
10-
<p>To test search pages, please make sure you <a href="test/index.html">have a valid token</a>.</p>
9+
<h2 id="test">Working examples</h2>
10+
11+
<div class="alert alert-info" role="alert">
12+
<h3>Before you test</h3>
13+
<p>To properly test pages below, such as getting results back from the search engine, please make sure you <a href="test/index.html">have a valid token</a>.</p>
14+
</div>
1115

1216
<h3>Regular pages</h3>
1317
<ul>
@@ -29,6 +33,7 @@ <h3>Advanced tests</h3>
2933
<li><a href="test/budget.html">Budget sample</a></li>
3034
<li><a href="test/gazette.html">Canada Gazette sample</a></li>
3135
<li><a href="test/template.html">Custom summary and results templates</a></li>
36+
<li><a href="test/no-token.html">Error message when no access token provided</a></li>
3237
<li><a href="test/newsadv-en.html">News Advanced Search user interface</a></li>
3338
<li><a href="test/newsadv-fr.html">Interface utilisateur de la recherche avancée d'actualités</a></li>
3439
</ul>

0 commit comments

Comments
 (0)