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
069a5475
Commit
069a5475
authored
Jul 07, 2013
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial commit for attempt at deep search with built in indexing
parent
f50e9fde
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
models/comment.rb
+7
-0
models/comment_thread.rb
+4
-1
No files found.
models/comment.rb
View file @
069a5475
...
...
@@ -20,6 +20,7 @@ class Comment < Content
belongs_to
:comment_thread
,
index:
true
belongs_to
:author
,
class_name:
"User"
,
index:
true
after_save
:update_thread_index
attr_accessible
:body
,
:course_id
,
:anonymous
,
:anonymous_to_peers
,
:endorsed
...
...
@@ -103,4 +104,10 @@ private
self
.
comment_thread
.
update_attributes!
(
last_activity_at:
Time
.
now
.
utc
)
end
def
update_thread_index
#after each save of a comment, update it's thread's search index
#t = self.comment_thread
tire
.
update_index
end
end
models/comment_thread.rb
View file @
069a5475
...
...
@@ -46,10 +46,13 @@ class CommentThread < Content
indexes
:author_id
,
type: :string
,
as:
'author_id'
,
index: :not_analyzed
,
included_in_all:
false
indexes
:group_id
,
type: :integer
,
as:
'group_id'
,
index: :not_analyzed
,
included_in_all:
false
#indexes :pinned, type: :boolean, as: 'pinned', index: :not_analyzed, included_in_all: false
indexes
:comments
do
indexes
:body
,
analyzer:
'snowball'
end
end
belongs_to
:author
,
class_name:
"User"
,
inverse_of: :comment_threads
,
index:
true
#, autosave: true
has_many
:comments
,
dependent: :destroy
#, autosave: true# Use destroy to envoke callback on the top-level comments TODO async
has_many
:comments
,
dependent: :destroy
#, autosave: true# Use destroy to envoke callback on the top-level comments TODO async
has_many
:activities
,
autosave:
true
attr_accessible
:title
,
:body
,
:course_id
,
:commentable_id
,
:anonymous
,
:anonymous_to_peers
,
:closed
...
...
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