-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(search): Ajout de Google CSE (moteur de recherche)
Il s'agit d'un test produit, pour valider l'hypothèse selon laquelle la recherche textuelle permettrait aux accompagnateurs de trouver plus facilement et rapidement les services d'insertion pour la personne qu'ils accompagnent. Plutôt que poser toute une architecture interne de moteur de recherche textuelle avancée, nous testons un prototype très rapide basé sur Google. Celui-ci ne permet de rechercher et proposer seulement les services gérés dans DORA (donc, pas ceux de data•inclusion), référencés sur Google Search. La fonctionnalité embarque : * une nouvelle page à l'URL /recherche-textuelle * cette page est non-SSR * pour activer la fonctionnalité, il faut au prélable avoir définie la variable d'environnement VITE_GOOGLE_CSE_ID (fichier .env pour du localhost) * les styles sont définis côté IHM d'admin de Google CSE (cse.google.com), sauf pour certains éléments spécifiques * attention ! cette fonctionnalié oblige à ouvrir de nombreuses CSP et notamment autoriser le `unsafe-eval` pour le type "script-src" Dans les prochains mois, une fois que l'expérience aura porté ses résultats et que l'hypothèse pourra être conclue (validée ou pas), ce code sera retiré.
- Loading branch information
Showing
6 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<script lang="ts"> | ||
import { onMount } from "svelte"; | ||
Check failure on line 2 in front/src/routes/recherche-textuelle/+page.svelte
|
||
import Breadcrumb from "$lib/components/display/breadcrumb.svelte"; | ||
import CenteredGrid from "$lib/components/display/centered-grid.svelte"; | ||
import { GOOGLE_CSE_ID } from "$lib/env"; | ||
import type { PageData } from "./$types"; | ||
Check failure on line 8 in front/src/routes/recherche-textuelle/+page.svelte
|
||
import Notice from "$lib/components/display/notice.svelte"; | ||
</script> | ||
|
||
<svelte:head> | ||
{#if GOOGLE_CSE_ID} | ||
<!-- Google Custom Search Engine --> | ||
<script | ||
async | ||
src={`https://cse.google.com/cse.js?cx=${GOOGLE_CSE_ID}`} | ||
></script> | ||
|
||
<!-- Les couleurs et polices sont définies directement depuis l'interface de gestion du moteur de recherche. --> | ||
<!-- Pour ce qui est des espacements ou de certains éléments non souhaitables, il faut les gérer ici. --> | ||
<style> | ||
.gsc-control-cse { | ||
padding: 0 !important; | ||
} | ||
.gsc-input { | ||
background: none !important; | ||
} | ||
.gcsc-find-more-on-google-branding { | ||
display: none !important; | ||
} | ||
</style> | ||
{/if} | ||
</svelte:head> | ||
|
||
<CenteredGrid> | ||
<div class="gap-s32 flex flex-col"> | ||
<h1 class="sr-only"> | ||
Résultats de votre recherche de services d’insertion | ||
</h1> | ||
|
||
<Breadcrumb currentLocation="text-search" dark></Breadcrumb> | ||
|
||
<div> | ||
<p class="text-f12 text-gray-text-alt2 italic"> | ||
Saisissez vos mots-clés et cliquez sur la loupe pour lancer la | ||
recherche. | ||
</p> | ||
<div class="gcse-search"></div> | ||
</div> | ||
|
||
<Notice | ||
title="Nous expérimentons la recherche par mot-clés pour tester son efficacité" | ||
type="warning" | ||
showIcon={false} | ||
> | ||
<div> | ||
Vous allez tester une version expérimentale de notre moteur de | ||
recherche. Les résultats pourraient être moins précis ou moins nombreux | ||
qu’une recherche par thématiques ou besoins. Vos retours seront précieux | ||
pour l’améliorer. <a | ||
class="text-magenta-cta underline" | ||
href="https://tally.so/r/mYJ1qW" | ||
target="_blank">Donnez votre avis</a | ||
> | ||
</div> | ||
</Notice> | ||
</div> | ||
</CenteredGrid> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const ssr = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters