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
970a029f
Commit
970a029f
authored
May 05, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the reference pattern for merge requests in elasticsearch
parent
0d6ec15f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
4 deletions
+6
-4
app/models/concerns/elastic/application_search.rb
app/models/concerns/elastic/application_search.rb
+1
-1
app/models/concerns/elastic/issues_search.rb
app/models/concerns/elastic/issues_search.rb
+1
-1
app/models/concerns/elastic/merge_requests_search.rb
app/models/concerns/elastic/merge_requests_search.rb
+2
-2
spec/models/concerns/elastic/issue_spec.rb
spec/models/concerns/elastic/issue_spec.rb
+1
-0
spec/models/concerns/elastic/merge_request_spec.rb
spec/models/concerns/elastic/merge_request_spec.rb
+1
-0
No files found.
app/models/concerns/elastic/application_search.rb
View file @
970a029f
...
...
@@ -147,7 +147,7 @@ module Elastic
query_hash
end
def
iid_query_hash
(
query_hash
,
iid
)
def
iid_query_hash
(
iid
)
{
query:
{
bool:
{
...
...
app/models/concerns/elastic/issues_search.rb
View file @
970a029f
...
...
@@ -49,7 +49,7 @@ module Elastic
def
self
.
elastic_search
(
query
,
options:
{})
query_hash
=
if
query
=~
/#(\d+)\z/
iid_query_hash
(
query_hash
,
$1
)
iid_query_hash
(
$1
)
else
basic_query_hash
(
%w(title^2 description)
,
query
)
end
...
...
app/models/concerns/elastic/merge_requests_search.rb
View file @
970a029f
...
...
@@ -61,8 +61,8 @@ module Elastic
def
self
.
elastic_search
(
query
,
options:
{})
query_hash
=
if
query
=~
/
#
(\d+)\z/
iid_query_hash
(
query_hash
,
$1
)
if
query
=~
/
\!
(\d+)\z/
iid_query_hash
(
$1
)
else
basic_query_hash
(
%w(title^2 description)
,
query
)
end
...
...
spec/models/concerns/elastic/issue_spec.rb
View file @
970a029f
...
...
@@ -28,6 +28,7 @@ describe Issue, elastic: true do
options
=
{
project_ids:
[
project
.
id
]
}
expect
(
described_class
.
elastic_search
(
'(term1 | term2 | term3) +bla-bla'
,
options:
options
).
total_count
).
to
eq
(
2
)
expect
(
described_class
.
elastic_search
(
Issue
.
last
.
to_reference
,
options:
options
).
total_count
).
to
eq
(
1
)
end
it
"returns json with all needed elements"
do
...
...
spec/models/concerns/elastic/merge_request_spec.rb
View file @
970a029f
...
...
@@ -28,6 +28,7 @@ describe MergeRequest, elastic: true do
options
=
{
project_ids:
[
project
.
id
]
}
expect
(
described_class
.
elastic_search
(
'term1 | term2 | term3'
,
options:
options
).
total_count
).
to
eq
(
2
)
expect
(
described_class
.
elastic_search
(
MergeRequest
.
last
.
to_reference
,
options:
options
).
total_count
).
to
eq
(
1
)
end
it
"returns json with all needed elements"
do
...
...
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