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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
e07b2f52
Commit
e07b2f52
authored
Mar 14, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix global search
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
02b310df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
1 deletion
+4
-1
CHANGELOG
CHANGELOG
+1
-0
app/controllers/search_controller.rb
app/controllers/search_controller.rb
+1
-0
app/services/search/global_service.rb
app/services/search/global_service.rb
+2
-1
No files found.
CHANGELOG
View file @
e07b2f52
...
@@ -20,6 +20,7 @@ v 6.7.0
...
@@ -20,6 +20,7 @@ v 6.7.0
- Add retry feature for repository import
- Add retry feature for repository import
- Reuse the GitLab LDAP connection within each request
- Reuse the GitLab LDAP connection within each request
- Changed markdown new line behaviour to conform to markdown standards
- Changed markdown new line behaviour to conform to markdown standards
- Fix global search
v 6.6.2
v 6.6.2
...
...
app/controllers/search_controller.rb
View file @
e07b2f52
...
@@ -7,6 +7,7 @@ class SearchController < ApplicationController
...
@@ -7,6 +7,7 @@ class SearchController < ApplicationController
if
@project
if
@project
return
access_denied!
unless
can?
(
current_user
,
:download_code
,
@project
)
return
access_denied!
unless
can?
(
current_user
,
:download_code
,
@project
)
@search_results
=
Search
::
ProjectService
.
new
(
@project
,
current_user
,
params
).
execute
@search_results
=
Search
::
ProjectService
.
new
(
@project
,
current_user
,
params
).
execute
else
else
@search_results
=
Search
::
GlobalService
.
new
(
current_user
,
params
).
execute
@search_results
=
Search
::
GlobalService
.
new
(
current_user
,
params
).
execute
...
...
app/services/search/global_service.rb
View file @
e07b2f52
...
@@ -14,9 +14,10 @@ module Search
...
@@ -14,9 +14,10 @@ module Search
group
=
Group
.
find_by
(
id:
params
[
:group_id
])
if
params
[
:group_id
].
present?
group
=
Group
.
find_by
(
id:
params
[
:group_id
])
if
params
[
:group_id
].
present?
projects
=
Project
.
accessible_to
(
current_user
)
projects
=
Project
.
accessible_to
(
current_user
)
projects
=
projects
.
where
(
namespace_id:
group
.
id
)
if
group
projects
=
projects
.
where
(
namespace_id:
group
.
id
)
if
group
projects
=
projects
.
search
(
query
)
project_ids
=
projects
.
pluck
(
:id
)
project_ids
=
projects
.
pluck
(
:id
)
projects
=
projects
.
search
(
query
)
result
[
:projects
]
=
projects
.
limit
(
20
)
result
[
:projects
]
=
projects
.
limit
(
20
)
result
[
:merge_requests
]
=
MergeRequest
.
in_projects
(
project_ids
).
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:merge_requests
]
=
MergeRequest
.
in_projects
(
project_ids
).
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:issues
]
=
Issue
.
where
(
project_id:
project_ids
).
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:issues
]
=
Issue
.
where
(
project_id:
project_ids
).
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
...
...
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