Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
cs_comments_service
Commits
d01922ed
Commit
d01922ed
authored
May 15, 2013
by
Kevin Chugh
Committed by
Jay Zoldak
May 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cherry pick new reindex:
parent
a23e6f5f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
3 deletions
+34
-3
Rakefile
+34
-3
No files found.
Rakefile
View file @
d01922ed
...
...
@@ -224,9 +224,40 @@ namespace :db do
end
task
:reindex_search
=>
:environment
do
Tire
.
index
(
'comment_threads'
).
delete
CommentThread
.
create_elasticsearch_index
Tire
.
index
(
'comment_threads'
)
{
import
CommentThread
.
all
}
Mongoid
.
identity_map_enabled
=
false
klass
=
CommentThread
ENV
[
'CLASS'
]
=
klass
.
name
ENV
[
'INDEX'
]
=
new_index
=
klass
.
tire
.
index
.
name
<<
'_'
<<
Time
.
now
.
strftime
(
'%Y%m%d%H%M%S'
)
Rake
::
Task
[
"tire:import"
].
invoke
puts
'[IMPORT] about to swap index'
if
a
=
Tire
::
Alias
.
find
(
klass
.
tire
.
index
.
name
)
puts
"[IMPORT] aliases found:
#{
Tire
::
Alias
.
find
(
klass
.
tire
.
index
.
name
).
indices
.
to_ary
.
join
(
','
)
}
. deleting."
old_indices
=
Tire
::
Alias
.
find
(
klass
.
tire
.
index
.
name
).
indices
old_indices
.
each
do
|
index
|
a
.
indices
.
delete
index
end
a
.
indices
.
add
new_index
a
.
save
old_indices
.
each
do
|
index
|
puts
"[IMPORT] deleting index:
#{
index
}
"
i
=
Tire
::
Index
.
new
(
index
)
i
.
delete
if
i
.
exists?
end
else
puts
"[IMPORT] no aliases found. deleting index. creating new one and setting up alias."
klass
.
tire
.
index
.
delete
a
=
Tire
::
Alias
.
new
a
.
name
(
klass
.
tire
.
index
.
name
)
a
.
index
(
new_index
)
a
.
save
end
puts
"[IMPORT] done. Index: '
#{
new_index
}
' created."
end
task
:add_anonymous_to_peers
=>
:environment
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