Remove project join from project/group commit searches
What does this MR do and why?
This MR change Advanced Search queries for commits. It switches them from using has_parent
to using visibility_level
and repository_access_level
fields added by !78562 (merged). As soon as the migration completes we switch from
Click to expand the before query
{
"query": {
"bool": {
"must": {
"simple_query_string": {
"_name": "commit:match:search_terms",
"fields": [
"commit.message^10",
"commit.sha^5",
"commit.author.name^2",
"commit.author.email^2",
"commit.committer.name",
"commit.committer.email"
],
"query": "test",
"default_operator": "and"
}
},
"must_not": [],
"should": [],
"filter": [
{
"has_parent": {
"_name": "commit:authorized:project",
"parent_type": "project",
"query": {
"bool": {
"should": [
{
"bool": {
"filter": [
{
"term": {
"visibility_level": {
"_name": "commit:authorized:project:any",
"value": 0
}
}
},
{
"terms": {
"_name": "commit:authorized:project:repository:enabled_or_private",
"repository_access_level": [
20,
10
]
}
}
]
}
},
{
"bool": {
"_name": "commit:authorized:project:visibility:10:repository:access_level",
"filter": [
{
"term": {
"visibility_level": {
"_name": "commit:authorized:project:visibility:10",
"value": 10
}
}
},
{
"terms": {
"_name": "commit:authorized:project:visibility:10:repository:access_level:enabled_or_private",
"repository_access_level": [
20,
10
]
}
}
]
}
},
{
"bool": {
"_name": "commit:authorized:project:visibility:20:repository:access_level",
"filter": [
{
"term": {
"visibility_level": {
"_name": "commit:authorized:project:visibility:20",
"value": 20
}
}
},
{
"terms": {
"_name": "commit:authorized:project:visibility:20:repository:access_level:enabled_or_private",
"repository_access_level": [
20,
10
]
}
}
]
}
}
]
}
}
}
},
{
"term": {
"type": {
"_name": "doc:is_a:commit",
"value": "commit"
}
}
}
]
}
},
"size": 20,
"from": 0,
"sort": [
"_score"
]
}
to
Click to expand the after query
{
"query": {
"bool": {
"must": {
"simple_query_string": {
"_name": "commit:match:search_terms",
"fields": [
"commit.message^10",
"commit.sha^5",
"commit.author.name^2",
"commit.author.email^2",
"commit.committer.name",
"commit.committer.email"
],
"query": "test",
"default_operator": "and"
}
},
"must_not": [],
"should": [],
"filter": [
{
"bool": {
"should": [
{
"bool": {
"filter": [
{
"term": {
"visibility_level": {
"_name": "commit:authorized:project:any",
"value": 0
}
}
},
{
"terms": {
"_name": "commit:authorized:project:repository:enabled_or_private",
"repository_access_level": [
20,
10
]
}
}
]
}
},
{
"bool": {
"_name": "commit:authorized:project:visibility:10:repository:access_level",
"filter": [
{
"term": {
"visibility_level": {
"_name": "commit:authorized:project:visibility:10",
"value": 10
}
}
},
{
"terms": {
"_name": "commit:authorized:project:visibility:10:repository:access_level:enabled_or_private",
"repository_access_level": [
20,
10
]
}
}
]
}
},
{
"bool": {
"_name": "commit:authorized:project:visibility:20:repository:access_level",
"filter": [
{
"term": {
"visibility_level": {
"_name": "commit:authorized:project:visibility:20",
"value": 20
}
}
},
{
"terms": {
"_name": "commit:authorized:project:visibility:20:repository:access_level:enabled_or_private",
"repository_access_level": [
20,
10
]
}
}
]
}
}
]
}
},
{
"term": {
"type": {
"_name": "doc:is_a:commit",
"value": "commit"
}
}
}
]
}
},
"size": 20,
"from": 0,
"sort": [
"_score"
]
}
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #344458 (closed)
Edited by Dmitry Gruzd