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
1b2d12e7
Commit
1b2d12e7
authored
Mar 11, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't index newly created system messages and awards
parent
8a0ae304
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/models/note.rb
app/models/note.rb
+4
-0
lib/elastic/application_search.rb
lib/elastic/application_search.rb
+8
-3
No files found.
CHANGELOG-EE
View file @
1b2d12e7
...
...
@@ -8,6 +8,7 @@ v 8.6.0 (unreleased)
- [Elastic] Update index on push to wiki
- [Elastic] Use subprocesses for ElasticSearch index jobs
- [Elastic] More accurate as_indexed_json (More stable database indexer)
- [Elastic] Fix: Don't index newly created system messages and awards
v 8.5.4
- [Elastic][Security] Notes exposure
...
...
app/models/note.rb
View file @
1b2d12e7
...
...
@@ -125,6 +125,10 @@ class Note < ActiveRecord::Base
end
end
def
searchable?
!
is_award
&&
!
system
end
def
cross_reference?
system
&&
SystemNoteService
.
cross_reference?
(
note
)
end
...
...
lib/elastic/application_search.rb
View file @
1b2d12e7
...
...
@@ -31,22 +31,27 @@ module Elastic
}
after_commit
on: :create
do
if
Gitlab
.
config
.
elasticsearch
.
enabled
if
Gitlab
.
config
.
elasticsearch
.
enabled
&&
self
.
searchable?
ElasticIndexerWorker
.
perform_async
(
:index
,
self
.
class
.
to_s
,
self
.
id
)
end
end
after_commit
on: :update
do
if
Gitlab
.
config
.
elasticsearch
.
enabled
if
Gitlab
.
config
.
elasticsearch
.
enabled
&&
self
.
searchable?
ElasticIndexerWorker
.
perform_async
(
:update
,
self
.
class
.
to_s
,
self
.
id
)
end
end
after_commit
on: :destroy
do
if
Gitlab
.
config
.
elasticsearch
.
enabled
if
Gitlab
.
config
.
elasticsearch
.
enabled
&&
self
.
searchable?
ElasticIndexerWorker
.
perform_async
(
:delete
,
self
.
class
.
to_s
,
self
.
id
)
end
end
# Should be overridden in the models where not eveything should be indexed
def
searchable?
true
end
end
module
ClassMethods
...
...
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