Bonjour, une mise à jour de la forge logicielle est prévue mardi 02 Décembre 2021 de 08h à 9h. Celle-ci entrainera une interruption de service d'environ 1h de 8h à 9h. Cordialement, Maintenance forge logicielle

Commit f6f7627b authored by Matthieu BENOIST's avatar Matthieu BENOIST
Browse files

Merge branch 'DOS0086114' into 'master'

Add a post_filter for all scopes on ES request to exclude the pages from the search.

See merge request !110
parents af2b03a5 4887273e
Pipeline #9637 passed with stage
in 8 minutes and 48 seconds
{
"name": "webapp",
"version": "2.6.11",
"version": "2.6.12",
"license": "GNU Affero General Public License v3.0",
"scripts": {
"ng": "ng",
......
......@@ -513,19 +513,18 @@ export class ElasticsearchService {
requestOptions.body.query.bool['must'] = mustExpression;
// Filter by scope (dataset, service, post, page). If the scope is 'all', we don't apply any filter
if (options.scope.key !== scopesResearch.all.key) {
const filtersScope = [];
options.scope.elasticType.forEach((type) => {
filtersScope.push(type);
});
// For the scopes we use post_filter instead of filter.
// The difference is that the aggregations will be calculated before this filter is applied.
requestOptions.body['post_filter'] = {
terms: {
'type.keyword': filtersScope,
},
};
}
const filtersScope = [];
options.scope.elasticType.forEach((type) => {
filtersScope.push(type);
});
// For the scopes we use post_filter instead of filter.
// The difference is that the aggregations will be calculated before this filter is applied.
requestOptions.body['post_filter'] = {
terms: {
'type.keyword': filtersScope,
},
};
// Aggregations for the filter options
// We have different filters determined by 'index' property.
......
......@@ -4,7 +4,7 @@ export const scopesResearch = {
all: {
key: 'all',
label: geosource.researchScope.all,
elasticType: [''],
elasticType: ['dataset', 'nonGeographicDataset', 'series', 'nonGeographicSeries','service','post'],
errorItem: geosource.errorItem.all,
},
datasets:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment