Skip to content

Commit

Permalink
fix(recherche): remonter les pré-qualifiés dans la recherche (#6082)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-maillot authored Aug 30, 2024
1 parent 538dbeb commit f85f181
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions packages/code-du-travail-frontend/pages/recherche.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import styled from "styled-components";
import Metas from "../src/common/Metas";
import { ConventionModal } from "../src/conventions/SearchModal";
import { Layout } from "../src/layout/Layout";
import { fetchSearchResults } from "../src/search/search.service";
import SearchBar from "../src/search/SearchBar";
import { SearchResults } from "../src/search/SearchResults";
import { useRouter } from "next/router";
Expand Down Expand Up @@ -104,7 +103,7 @@ const SearchPage = ({

export const getServerSideProps: GetServerSideProps = async (context) => {
const q = (context.query.q as string) ?? "";
const items = await searchWithQuery(q, true, undefined);
const items = await searchWithQuery(q, false, undefined);
return { props: { items } };
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`Search searchWithQuery 1`] = `
{
"articles": [
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [],
"cdtnId": "6638a02755",
Expand All @@ -14,7 +14,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "L1231-1",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [],
"cdtnId": "ea03713a82",
Expand All @@ -24,7 +24,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "L1237-1",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [],
"cdtnId": "4c53e81904",
Expand All @@ -45,7 +45,7 @@ exports[`Search searchWithQuery 1`] = `
],
"documents": [
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand All @@ -66,7 +66,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "Démission d'un salarié",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand All @@ -87,7 +87,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "La démission",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand All @@ -108,7 +108,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "Un salarié peut-il percevoir l'allocation chômage en cas de démission ?",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand All @@ -134,7 +134,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "Peut-on démissionner pendant ses congés payés ?",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand All @@ -155,7 +155,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "Peut-on démissionner pendant un arrêt maladie ?",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand All @@ -176,7 +176,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "Peut-on démissionner pendant un congé maternité ?",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand All @@ -197,7 +197,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "Peut-on démissionner pendant un congé parental ?",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand All @@ -218,7 +218,7 @@ exports[`Search searchWithQuery 1`] = `
"title": "Démission du salarié à domicile employé par un particulier",
},
{
"_score": undefined,
"_score": null,
"algo": "pre-qualified",
"breadcrumbs": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,19 @@ export const searchWithQuery = async (

return {
articles: articles.map(({ _score, _source }) => ({
_score,
_score: _score ?? null,
..._source,
title: _source.shortTitle ?? _source.title,
})),
documents: documents.map(({ _score, _source }) => ({
_score,
_score: _score ?? null,
..._source,
title: _source.shortTitle ?? _source.title,
})),
// we add source prop since some result might come from dedicated themes index
// which has no source prop
themes: themes.map(({ _score, _source }) => ({
_score,
_score: _score ?? null,
..._source,
source: SOURCES.THEMES,
})),
Expand Down

0 comments on commit f85f181

Please sign in to comment.