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
60aa389b
Commit
60aa389b
authored
Jun 28, 2013
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add reindex to comments in addition to comment threads to enable deep search
parent
d1831811
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
28 deletions
+35
-28
Rakefile
+30
-28
models/comment_thread.rb
+5
-0
No files found.
Rakefile
View file @
60aa389b
...
...
@@ -227,38 +227,40 @@ namespace :db do
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
klasses
=
[
Comment
]
klasses
.
each
do
|
klass
|
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
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?
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
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."
puts
"[IMPORT] done. Index: '
#{
new_index
}
' created."
end
end
task
:add_anonymous_to_peers
=>
:environment
do
...
...
models/comment_thread.rb
View file @
60aa389b
...
...
@@ -107,6 +107,11 @@ class CommentThread < Content
end
end
#GET /api/v1/search/threads?user_id=1&recursive=False&sort_key=date&│[2013-06-28 10:16:46,104][INFO ][plugins ] [Glamor] loaded [], sites []
#text=response&sort_order=desc&course_id=HarvardX%2FHLS1xD%2FCopyright&per_page=20&api_key=PUT_YOUR_API_KE│T1GYWxzZSZzb3J0X2tleT1kYXRlJnRleHQ9cmVzcG9uc2Umc29ydF9vcmRlcj1kZXNjJmNvdXJzZV9pZA==: initialized
#Y_HERE&page=1
#KChugh - Unfortunately, there's no algorithmically nice way to handle pagination with
#stitching together Comments and CommentThreads, because there is no determinstic relationship
#between the ordinality of comments and threads.
...
...
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