Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8bc1a942
Commit
8bc1a942
authored
Jan 18, 2020
by
Changzheng Liu
Committed by
Peter Leitzen
Jan 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add project type for global search from ES
parent
67a61557
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
ee/changelogs/unreleased/cl-search-project-type.yml
ee/changelogs/unreleased/cl-search-project-type.yml
+5
-0
ee/lib/elastic/latest/project_class_proxy.rb
ee/lib/elastic/latest/project_class_proxy.rb
+1
-1
ee/spec/models/concerns/elastic/project_spec.rb
ee/spec/models/concerns/elastic/project_spec.rb
+18
-0
No files found.
ee/changelogs/unreleased/cl-search-project-type.yml
0 → 100644
View file @
8bc1a942
---
title
:
Make sure type is set properly in Elasticsearch query when doing global search
merge_request
:
22821
author
:
type
:
fixed
ee/lib/elastic/latest/project_class_proxy.rb
View file @
8bc1a942
...
...
@@ -8,7 +8,7 @@ module Elastic
query_hash
=
basic_query_hash
(
options
[
:in
],
query
)
filters
=
[]
filters
=
[
{
terms:
{
type:
[
es_type
]
}
}
]
if
options
[
:namespace_id
]
filters
<<
{
...
...
ee/spec/models/concerns/elastic/project_spec.rb
View file @
8bc1a942
...
...
@@ -94,6 +94,24 @@ describe Project, :elastic do
end
end
# This test is added to address the issues described in
context
'when projects and snippets co-exist'
,
issue:
'https://gitlab.com/gitlab-org/gitlab/issues/36340'
do
before
do
create
:project
create
:snippet
,
:public
end
context
'when searching with a wildcard'
do
it
'only returns projects'
,
:sidekiq_inline
do
Gitlab
::
Elastic
::
Helper
.
refresh_index
response
=
described_class
.
elastic_search
(
'*'
)
expect
(
response
.
total_count
).
to
eq
(
1
)
expect
(
response
.
results
.
first
[
'_source'
][
'type'
]).
to
eq
(
Project
.
es_type
)
end
end
end
it
"finds projects"
do
project_ids
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment