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
74f4bd10
Commit
74f4bd10
authored
Mar 14, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Elasticsearch queries when a group_id is specified
parent
a0b78db4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
3 deletions
+97
-3
app/services/search/global_service.rb
app/services/search/global_service.rb
+4
-3
changelogs/unreleased-ee/1899-elasticsearch-group-search.yml
changelogs/unreleased-ee/1899-elasticsearch-group-search.yml
+4
-0
spec/features/es_group_search_spec.rb
spec/features/es_group_search_spec.rb
+89
-0
No files found.
app/services/search/global_service.rb
View file @
74f4bd10
...
...
@@ -17,14 +17,15 @@ module Search
end
if
current_application_settings
.
elasticsearch_search?
projects
=
current_user
?
current_user
.
authorized_projects
:
Project
.
none
projects
=
projects
.
inside_path
(
group
.
id
)
if
group
unless
group
projects
=
current_user
?
current_user
.
authorized_projects
:
Project
.
none
end
Gitlab
::
Elastic
::
SearchResults
.
new
(
current_user
,
params
[
:search
],
projects
.
pluck
(
:id
),
!
group
!
group
# Ignore public projects outside of the group if provided
)
else
Gitlab
::
SearchResults
.
new
(
current_user
,
projects
,
params
[
:search
])
...
...
changelogs/unreleased-ee/1899-elasticsearch-group-search.yml
0 → 100644
View file @
74f4bd10
---
title
:
Fix Elasticsearch queries when a group_id is specified
merge_request
:
1423
author
:
spec/features/es_group_search_spec.rb
0 → 100644
View file @
74f4bd10
require
'spec_helper'
feature
'Group elastic search'
,
js:
true
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
def
choose_group
(
group
)
find
(
'.js-search-group-dropdown'
).
click
wait_for_ajax
page
.
within
'.search-holder'
do
click_link
group
.
name
end
end
before
do
stub_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
Gitlab
::
Elastic
::
Helper
.
create_empty_index
project
.
team
<<
[
user
,
:master
]
group
.
add_owner
(
user
)
login_with
(
user
)
end
after
do
Gitlab
::
Elastic
::
Helper
.
delete_index
stub_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
describe
'issue search'
do
before
do
create
(
:issue
,
project:
project
,
title:
'chosen issue title'
)
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
it
'finds the issue'
do
visit
search_path
choose_group
group
fill_in
'search'
,
with:
'chosen'
click_button
'Search'
select_filter
(
'Issues'
)
expect
(
page
).
to
have_content
(
'chosen issue title'
)
end
end
describe
'blob search'
do
before
do
project
.
repository
.
index_blobs
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
it
'finds files'
do
visit
search_path
choose_group
group
fill_in
'search'
,
with:
'def'
click_button
'Search'
select_filter
(
'Code'
)
expect
(
page
).
to
have_selector
(
'.file-content .code'
)
end
end
describe
'commit search'
do
before
do
project
.
repository
.
index_commits
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
it
'finds commits'
do
visit
search_path
choose_group
group
fill_in
'search'
,
with:
'add'
click_button
'Search'
select_filter
(
'Commits'
)
expect
(
page
).
to
have_selector
(
'.commit-list > .commit'
)
end
end
end
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