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
Kazuhiko Shiozaki
gitlab-ce
Commits
e7cf10e4
Commit
e7cf10e4
authored
Jun 24, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5531 from NotSqrt/add-search
Add ability to search in issue description and issue comments
parents
d7eb6e55
15e0ab49
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
+15
-2
app/services/search/global_service.rb
app/services/search/global_service.rb
+1
-0
app/services/search/project_service.rb
app/services/search/project_service.rb
+4
-2
app/views/search/_project_results.html.haml
app/views/search/_project_results.html.haml
+1
-0
app/views/search/results/_note.html.haml
app/views/search/results/_note.html.haml
+9
-0
No files found.
app/services/search/global_service.rb
View file @
e7cf10e4
...
@@ -28,6 +28,7 @@ module Search
...
@@ -28,6 +28,7 @@ module Search
projects:
[],
projects:
[],
merge_requests:
[],
merge_requests:
[],
issues:
[],
issues:
[],
notes:
[],
total_results:
0
,
total_results:
0
,
}
}
end
end
...
...
app/services/search/project_service.rb
View file @
e7cf10e4
...
@@ -18,8 +18,9 @@ module Search
...
@@ -18,8 +18,9 @@ module Search
result
[
:total_results
]
=
blobs
.
total_count
result
[
:total_results
]
=
blobs
.
total_count
else
else
result
[
:merge_requests
]
=
project
.
merge_requests
.
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:merge_requests
]
=
project
.
merge_requests
.
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:issues
]
=
project
.
issues
.
search
(
query
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:issues
]
=
project
.
issues
.
where
(
"title like :query OR description like :query "
,
query:
"%
#{
query
}
%"
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:total_results
]
=
%w(issues merge_requests)
.
sum
{
|
items
|
result
[
items
.
to_sym
].
size
}
result
[
:notes
]
=
Note
.
where
(
noteable_type:
'issue'
).
where
(
project_id:
project
.
id
).
where
(
"note like :query"
,
query:
"%
#{
query
}
%"
).
order
(
'updated_at DESC'
).
limit
(
20
)
result
[
:total_results
]
=
%w(issues merge_requests notes)
.
sum
{
|
items
|
result
[
items
.
to_sym
].
size
}
end
end
result
result
...
@@ -30,6 +31,7 @@ module Search
...
@@ -30,6 +31,7 @@ module Search
merge_requests:
[],
merge_requests:
[],
issues:
[],
issues:
[],
blobs:
[],
blobs:
[],
notes:
[],
total_results:
0
,
total_results:
0
,
}
}
end
end
...
...
app/views/search/_project_results.html.haml
View file @
e7cf10e4
...
@@ -15,3 +15,4 @@
...
@@ -15,3 +15,4 @@
%ul
.bordered-list
%ul
.bordered-list
=
render
partial:
"search/results/merge_request"
,
collection:
@search_results
[
:merge_requests
]
=
render
partial:
"search/results/merge_request"
,
collection:
@search_results
[
:merge_requests
]
=
render
partial:
"search/results/issue"
,
collection:
@search_results
[
:issues
]
=
render
partial:
"search/results/issue"
,
collection:
@search_results
[
:issues
]
=
render
partial:
"search/results/note"
,
collection:
@search_results
[
:notes
]
app/views/search/results/_note.html.haml
0 → 100644
View file @
e7cf10e4
%li
note on issue:
=
link_to
[
note
.
project
,
note
.
noteable
]
do
%span
##{note.noteable.iid}
%strong
.term
=
truncate
note
.
noteable
.
title
,
length:
50
%span
.light
(
#{
note
.
project
.
name_with_namespace
}
)
-
if
note
.
noteable
.
closed?
%span
.label
Closed
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