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
9223e824
Commit
9223e824
authored
Jan 19, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ES: satisfy flay
parent
fa793dd9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
16 deletions
+14
-16
app/elastic/merge_requests_search.rb
app/elastic/merge_requests_search.rb
+1
-3
app/elastic/snippets_search.rb
app/elastic/snippets_search.rb
+13
-13
No files found.
app/elastic/merge_requests_search.rb
View file @
9223e824
...
...
@@ -43,9 +43,7 @@ module MergeRequestsSearch
end
def
self
.
elastic_search
(
query
,
options:
{})
options
[
:in
]
=
%w(title^2 description)
query_hash
=
basic_query_hash
(
options
[
:in
],
query
)
query_hash
=
basic_query_hash
(
%w(title^2 description)
,
query
)
if
options
[
:projects_ids
]
query_hash
[
:query
][
:filtered
][
:filter
]
=
{
...
...
app/elastic/snippets_search.rb
View file @
9223e824
...
...
@@ -36,15 +36,9 @@ module SnippetsSearch
end
def
self
.
elastic_search
(
query
,
options:
{})
options
[
:in
]
=
%w(title file_name)
query_hash
=
basic_query_hash
(
options
[
:in
],
query
)
query_hash
=
basic_query_hash
(
%w(title file_name)
,
query
)
if
options
[
:ids
]
query_hash
[
:query
][
:filtered
][
:filter
]
=
{
and:
[
{
terms:
{
id:
[
options
[
:ids
]].
flatten
}
}
]
}
end
query_hash
=
limit_ids
(
query_hash
,
options
[
:ids
])
self
.
__elasticsearch__
.
search
(
query_hash
)
end
...
...
@@ -58,11 +52,7 @@ module SnippetsSearch
}
}
if
options
[
:ids
]
query_hash
[
:query
][
:filtered
][
:filter
]
=
{
and:
[
{
terms:
{
id:
[
options
[
:ids
]].
flatten
}
}
]
}
end
query_hash
=
limit_ids
(
query_hash
,
options
[
:ids
])
query_hash
[
:sort
]
=
[
{
updated_at_sort:
{
order: :desc
,
mode: :min
}
},
...
...
@@ -73,5 +63,15 @@ module SnippetsSearch
self
.
__elasticsearch__
.
search
(
query_hash
)
end
def
self
.
limit_ids
(
query_hash
,
ids
)
if
ids
query_hash
[
:query
][
:filtered
][
:filter
]
=
{
and:
[
{
terms:
{
id:
ids
}
}
]
}
end
query_hash
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