You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-10Lines changed: 26 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,23 +21,23 @@ The goal is to continue to refine and improve this code base on a regular basis.
21
21
22
22
### Improvement plan
23
23
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.
25
25
26
26
Example of code contributions may be related to:
27
27
28
28
- development/configurations of AI-powered features and other innovations
29
29
- bug fixes, accessibility and security improvements
30
30
- project maintenance chores
31
31
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).
33
33
34
34
## Releases and API
35
35
36
36
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.
37
37
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.
Aside from the evaluation based on usage, Search UI follows [Semantic Versioning 2.0.0](https://semver.org/)
41
41
42
42
---
43
43
@@ -120,6 +120,10 @@ They must be used within the `[data-gc-search]` attribute. See the **/test/src-e
120
120
: 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`
121
121
-`originLevel3`
122
122
: 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
123
127
124
128
#### Templates
125
129
@@ -138,15 +142,15 @@ For example, to override the search results template, you would do something alo
138
142
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.
139
143
140
144
-`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
142
146
-`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
144
148
-`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
146
150
-`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
148
152
-`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
150
154
-`sr-did-you-mean`
151
155
: For the "Did you mean" suggestion section
152
156
-`sr-pager-previous`
@@ -157,6 +161,8 @@ Template override should technically only be used on a few instances of the sear
157
161
: For the next page button
158
162
-`sr-pager-container`
159
163
: For the wrapper of all pagniation button
164
+
-`sr-qs-hint`
165
+
: Message announced to screen reader to provide instructions on QS
160
166
161
167
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.
162
168
@@ -196,6 +202,10 @@ Here is the extensive list of what variables can be used in templates:
196
202
: 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
197
203
-`page`
198
204
: 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".
199
209
200
210
#### Parameters
201
211
@@ -218,7 +228,7 @@ Sometimes your search pages contain more than one input relevant to the search's
218
228
-`dmn`
219
229
: Search for search terms in input, only on a specific domain
220
230
-`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`
222
232
-`elctn_cat`
223
233
: Used specifically for Elections Canada, to define a scope of search amongst their collection. See **/src/connector.js** to see all the options available
224
234
-`site`
@@ -229,6 +239,12 @@ Sometimes your search pages contain more than one input relevant to the search's
229
239
: 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`
230
240
-`originLevel3`
231
241
: 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)
Copy file name to clipboardExpand all lines: index.html
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,17 @@
1
1
---
2
2
title: Search user interface (UI) with Headless
3
3
lang: en
4
-
dateModified: 2025-08-04
4
+
dateModified: 2025-11-03
5
5
---
6
6
7
7
<pclass="lead">This is a demo site for the GC Search UI.</p>
8
8
9
-
<h2id="test">Test pages</h2>
10
-
<p>To test search pages, please make sure you <ahref="test/index.html">have a valid token</a>.</p>
9
+
<h2id="test">Working examples</h2>
10
+
11
+
<divclass="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 <ahref="test/index.html">have a valid token</a>.</p>
0 commit comments