From 8c91382b9b0e18bc45bcab3d28202a7a00e2535d Mon Sep 17 00:00:00 2001 From: LionelB Date: Tue, 25 Jun 2019 21:36:06 +0200 Subject: [PATCH] fix(api): add a boost to article_id match --- .../server/routes/__tests__/__snapshots__/search.spec.js.snap | 4 ++-- .../src/server/routes/search/facets.elastic.js | 3 ++- .../src/server/routes/search/search.elastic.js | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/code-du-travail-api/src/server/routes/__tests__/__snapshots__/search.spec.js.snap b/packages/code-du-travail-api/src/server/routes/__tests__/__snapshots__/search.spec.js.snap index c5975a9a43..1e1f7c0a93 100644 --- a/packages/code-du-travail-api/src/server/routes/__tests__/__snapshots__/search.spec.js.snap +++ b/packages/code-du-travail-api/src/server/routes/__tests__/__snapshots__/search.spec.js.snap @@ -17,7 +17,7 @@ Object { Object { "_id": "8", "_index": "cdtn_document_test", - "_score": 7.8337746, + "_score": 10.606363, "_source": Object { "slug": "r1225-18", "source": "code_du_travail", @@ -40,7 +40,7 @@ Object { "_type": "cdtn_document_test", }, ], - "max_score": 7.8337746, + "max_score": 10.606363, "total": 2, }, } diff --git a/packages/code-du-travail-api/src/server/routes/search/facets.elastic.js b/packages/code-du-travail-api/src/server/routes/search/facets.elastic.js index e07320d52f..b9c2cdee5c 100644 --- a/packages/code-du-travail-api/src/server/routes/search/facets.elastic.js +++ b/packages/code-du-travail-api/src/server/routes/search/facets.elastic.js @@ -27,7 +27,8 @@ function getFacetsBody({ query }) { { match: { "title.article_id": { - query: query + query: query, + boost: 5 } } }, diff --git a/packages/code-du-travail-api/src/server/routes/search/search.elastic.js b/packages/code-du-travail-api/src/server/routes/search/search.elastic.js index 7b36bc657f..945e8c070e 100644 --- a/packages/code-du-travail-api/src/server/routes/search/search.elastic.js +++ b/packages/code-du-travail-api/src/server/routes/search/search.elastic.js @@ -43,7 +43,8 @@ function getSearchBody({ query, size, excludeSources = [] }) { { match: { "title.article_id": { - query: query + query: query, + boost: 5 } } },