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
a383f6ec
Commit
a383f6ec
authored
Jan 29, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ES: advanced rake tasks
parent
bb6f2894
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
lib/tasks/gitlab/elastic.rake
lib/tasks/gitlab/elastic.rake
+27
-1
No files found.
lib/tasks/gitlab/elastic.rake
View file @
a383f6ec
...
@@ -4,7 +4,17 @@ namespace :gitlab do
...
@@ -4,7 +4,17 @@ namespace :gitlab do
task
index_repositories: :environment
do
task
index_repositories: :environment
do
Repository
.
__elasticsearch__
.
create_index!
Repository
.
__elasticsearch__
.
create_index!
Project
.
find_each
do
|
project
|
projects
=
Project
if
ENV
[
'ID_FROM'
]
projects
=
projects
.
where
(
"id >= ?"
,
ENV
[
'ID_FROM'
])
end
if
ENV
[
'ID_TO'
]
projects
=
projects
.
where
(
"id <= ?"
,
ENV
[
'ID_TO'
])
end
projects
.
find_each
do
|
project
|
if
project
.
repository
.
exists?
&&
!
project
.
repository
.
empty?
if
project
.
repository
.
exists?
&&
!
project
.
repository
.
empty?
puts
"Indexing
#{
project
.
name_with_namespace
}
..."
puts
"Indexing
#{
project
.
name_with_namespace
}
..."
...
@@ -48,5 +58,21 @@ namespace :gitlab do
...
@@ -48,5 +58,21 @@ namespace :gitlab do
end
end
end
end
end
end
desc
"Create empty indexes"
task
create_empty_indexes: :environment
do
[
Project
,
Issue
,
MergeRequest
,
Snippet
,
Note
,
Milestone
,
ProjectWiki
,
Repository
].
each
do
|
klass
|
klass
.
__elasticsearch__
.
create_index!
end
end
end
end
end
end
\ No newline at end of file
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