Commit 7593a2e3 authored by Valery Sizov's avatar Valery Sizov

ES: not every notes should be indexed

parent 7c52a0b7
......@@ -59,6 +59,7 @@ class Note < ActiveRecord::Base
# Scopes
scope :awards, ->{ where(is_award: true) }
scope :nonawards, ->{ where(is_award: false) }
scope :searchable, ->{ where("is_award IS FALSE AND system IS FALSE") }
scope :for_commit_id, ->(commit_id) { where(noteable_type: "Commit", commit_id: commit_id) }
scope :inline, ->{ where("line_code IS NOT NULL") }
scope :not_inline, ->{ where(line_code: [nil, '']) }
......
......@@ -14,7 +14,12 @@ namespace :gitlab do
task index_database: :environment do
[Project, Issue, MergeRequest, Snippet, Note, Milestone].each do |klass|
klass.__elasticsearch__.create_index!
klass.import
if klass == Note
Note.searchable.import
else
klass.import
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment