Remove highlight in query for notes
What does this MR do and why?
I thought I removed this in !201004 (merged), but the highlight remains in the ES query This is due to basic_query_hash adding highlight if the options[:count_only] is not set
This MR
- adds another option to ensure that when
noteable_typeANDrelated_ids_onlyare set in the options, it does not include highlighting. I think it's important to add this distinction because we could allow comments to be filtered by the type (issues, mr, commit, etc). That is different than when another search is looking for related ids - fixes the fact that tests did not catch this
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
The query from issues scope now has
- size: 100
- _source: 'noteable_id`
- no highlight
POST gitlab-development-notes/_search?timeout=30s
{ "query": { "bool": { "must": [ { "bool": { "should": [ { "multi_match": { "_name": "note:multi_match:and:search_terms", "fields": [ "note" ], "query": "test", "operator": "and", "lenient": true } }, { "multi_match": { "_name": "note:multi_match_phrase:search_terms", "type": "phrase", "fields": [ "note" ], "query": "test", "lenient": true } } ], "minimum_should_match": 1 } } ], "should": [], "filter": [ { "bool": { "should": [ { "terms": { "_name": "filters:permissions:global:issues_access_level:enabled_or_private", "issues_access_level": [ 20, 10 ] } } ], "minimum_should_match": 1 } }, { "bool": { "_name": "note:archived:non_archived", "should": [ { "bool": { "filter": { "term": { "archived": { "value": false } } } } }, { "bool": { "must_not": { "exists": { "field": "archived" } } } } ] } }, { "term": { "noteable_type": { "_name": "filters:related:issue", "value": "Issue" } } } ] } }, "_source": [ "noteable_id" ], "size": 100 }
the query from notes scope has
- highlight
- no
_source - no
size
POST gitlab-development-notes/_search?from=0&size=20&timeout=30s
{ "query": { "bool": { "must": [ { "bool": { "should": [ { "multi_match": { "_name": "note:multi_match:and:search_terms", "fields": [ "note" ], "query": "test", "operator": "and", "lenient": true } }, { "multi_match": { "_name": "note:multi_match_phrase:search_terms", "type": "phrase", "fields": [ "note" ], "query": "test", "lenient": true } } ], "minimum_should_match": 1 } } ], "should": [], "filter": [ { "bool": { "should": [ { "terms": { "_name": "filters:permissions:global:issues_access_level:enabled_or_private", "issues_access_level": [ 20, 10 ] } }, { "terms": { "_name": "filters:permissions:global:merge_requests_access_level:enabled_or_private", "merge_requests_access_level": [ 20, 10 ] } }, { "terms": { "_name": "filters:permissions:global:snippets_access_level:enabled_or_private", "snippets_access_level": [ 20, 10 ] } }, { "terms": { "_name": "filters:permissions:global:repository_access_level:enabled_or_private", "repository_access_level": [ 20, 10 ] } } ], "minimum_should_match": 1 } }, { "bool": { "_name": "note:archived:non_archived", "should": [ { "bool": { "filter": { "term": { "archived": { "value": false } } } } }, { "bool": { "must_not": { "exists": { "field": "archived" } } } } ] } } ] } }, "highlight": { "fields": { "note": {} }, "number_of_fragments": 0, "pre_tags": [ "gitlabelasticsearch→" ], "post_tags": [ "←gitlabelasticsearch" ] } }
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Terri Chu