Commit cff9aaf9 authored by Matthieu Benoist's avatar Matthieu Benoist
Browse files

Autocomplete reuest changes

parent e26f3b9a
{ {
"name": "webapp", "name": "webapp",
"version": "2.6.13", "version": "2.7.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
......
...@@ -364,9 +364,11 @@ export class DatasetResearchService { ...@@ -364,9 +364,11 @@ export class DatasetResearchService {
// We check if this text highlight already exists in the options array // We check if this text highlight already exists in the options array
// We want a unique text in the list, no duplicata. // We want a unique text in the list, no duplicata.
const found = options.some((el) => { const found = options.some((el) => {
return el.text === highlight[key][0]; return el.text.toLowerCase() === highlight[key][0].toLowerCase();
}); });
if (!found && options.length < 5) { const same = text.toLowerCase() === highlight[key][0].toLowerCase().replace(/<[^>]*>/g, '');;
if (!same && !found && options.length < 5) {
searchOption['text'] = highlight[key][0]; searchOption['text'] = highlight[key][0];
options.push(new SearchCompletion(searchOption)); options.push(new SearchCompletion(searchOption));
} }
......
...@@ -192,6 +192,9 @@ export class ElasticsearchService { ...@@ -192,6 +192,9 @@ export class ElasticsearchService {
], ],
}, },
}, },
collapse: {
field: 'metadata-fr.geonet:info.uuid.keyword',
},
highlight: { highlight: {
order: 'score', order: 'score',
pre_tags: ['<b>'], pre_tags: ['<b>'],
...@@ -199,8 +202,19 @@ export class ElasticsearchService { ...@@ -199,8 +202,19 @@ export class ElasticsearchService {
highlight_query: { highlight_query: {
query_string: { query_string: {
query: regex, query: regex,
fields: ['data_and_metadata', 'content-fr.title', 'content-fr.plaintext'], fields: [
'metadata-fr.title^5',
'data-fr.properties^3',
'data-and-metadata',
'metadata-fr.abstract^4',
'metadata-fr.lineage^3',
'content-fr.title^5',
'content-fr.excerpt^4',
'content-fr.plaintext^3'
],
analyzer: 'my_search_analyzer', analyzer: 'my_search_analyzer',
// fields: ['data_and_metadata', 'content-fr.title', 'content-fr.plaintext'],
// analyzer: 'my_search_analyzer',
fuzziness: 'AUTO', fuzziness: 'AUTO',
minimum_should_match: '90%', minimum_should_match: '90%',
}, },
...@@ -220,6 +234,9 @@ export class ElasticsearchService { ...@@ -220,6 +234,9 @@ export class ElasticsearchService {
fragment_size: 50, fragment_size: 50,
number_of_fragments: 5, number_of_fragments: 5,
}, },
'metadata-fr.title': {
number_of_fragments: 0,
}
}, },
}, },
}; };
...@@ -227,7 +244,16 @@ export class ElasticsearchService { ...@@ -227,7 +244,16 @@ export class ElasticsearchService {
request.query.bool.must.push({ request.query.bool.must.push({
multi_match: { multi_match: {
query: regex, query: regex,
fields: ['content-fr.title', 'content-fr.plaintext', 'data_and_metadata'], fields: [
'metadata-fr.title^5',
'data-fr.properties^3',
'data-and-metadata',
'metadata-fr.abstract^4',
'metadata-fr.lineage^3',
'content-fr.title^5',
'content-fr.excerpt^4',
'content-fr.plaintext^3'
],
}, },
}); });
......
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