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
e3b5b46c
Commit
e3b5b46c
authored
Oct 24, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Elasticsearch::Transport::Transport::Errors::BadRequest
parent
cea77efe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
0 deletions
+32
-0
CHANGELOG-EE.md
CHANGELOG-EE.md
+4
-0
app/models/diff_note.rb
app/models/diff_note.rb
+5
-0
app/models/legacy_diff_note.rb
app/models/legacy_diff_note.rb
+5
-0
spec/models/concerns/elastic/note_spec.rb
spec/models/concerns/elastic/note_spec.rb
+18
-0
No files found.
CHANGELOG-EE.md
View file @
e3b5b46c
Please view this file on the master branch, on stable branches it's out of date.
## 8.13.1
-
Fix Elasticsearch::Transport::Transport::Errors::BadRequest when ES is enabled. #21036
## 8.13.0 (2016-10-22)
-
Cache the last usage data to avoid unicorn timeouts
...
...
app/models/diff_note.rb
View file @
e3b5b46c
class
DiffNote
<
Note
# Elastic search configuration (it does not support STI properly)
document_type
'note'
index_name
[
Rails
.
application
.
class
.
parent_name
.
downcase
,
Rails
.
env
].
join
(
'-'
)
include
Elastic
::
NotesSearch
include
NoteOnDiff
serialize
:original_position
,
Gitlab
::
Diff
::
Position
...
...
app/models/legacy_diff_note.rb
View file @
e3b5b46c
class
LegacyDiffNote
<
Note
# Elastic search configuration (it does not support STI properly)
document_type
'note'
index_name
[
Rails
.
application
.
class
.
parent_name
.
downcase
,
Rails
.
env
].
join
(
'-'
)
include
Elastic
::
NotesSearch
include
NoteOnDiff
serialize
:st_diff
...
...
spec/models/concerns/elastic/note_spec.rb
View file @
e3b5b46c
...
...
@@ -29,6 +29,24 @@ describe Note, elastic: true do
expect
(
described_class
.
elastic_search
(
'term'
,
options:
options
).
total_count
).
to
eq
(
1
)
end
it
"indexes && searches diff notes"
do
notes
=
[]
Sidekiq
::
Testing
.
inline!
do
notes
<<
create
(
:diff_note_on_merge_request
,
note:
"term"
)
notes
<<
create
(
:diff_note_on_commit
,
note:
"term"
)
notes
<<
create
(
:legacy_diff_note_on_merge_request
,
note:
"term"
)
notes
<<
create
(
:legacy_diff_note_on_commit
,
note:
"term"
)
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
project_ids
=
notes
.
map
{
|
note
|
note
.
noteable
.
project
.
id
}
options
=
{
project_ids:
project_ids
}
expect
(
described_class
.
elastic_search
(
'term'
,
options:
options
).
total_count
).
to
eq
(
4
)
end
it
"returns json with all needed elements"
do
note
=
create
:note
...
...
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