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
78c8e6b8
Commit
78c8e6b8
authored
May 01, 2014
by
Jim Abramson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #97 from edx/jsa/tire-match
upgrade tire to 0.5.2, update use of deprecated "text" search api
parents
590e458a
6beafbc9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
16 deletions
+12
-16
Gemfile
+1
-1
Gemfile.lock
+6
-6
app.rb
+1
-1
models/comment_thread.rb
+2
-2
spec/app_spec.rb
+2
-6
No files found.
Gemfile
View file @
78c8e6b8
...
...
@@ -35,7 +35,7 @@ gem 'will_paginate_mongoid'
gem
'
rdiscount
'
gem
'
nokogiri
'
gem
'
tire
'
gem
'
tire
'
,
"0.5.2"
gem
'
tire-contrib
'
gem
'
dalli
'
...
...
Gemfile.lock
View file @
78c8e6b8
...
...
@@ -83,14 +83,14 @@ GEM
thor (>= 0.14.6)
guard-unicorn (0.0.7)
guard (>= 1.1)
hashr (0.0.2
1
)
hashr (0.0.2
2
)
hike (1.2.1)
i18n (0.6.9)
journey (1.0.4)
kgio (2.7.4)
listen (0.5.0)
method_source (0.8)
mime-types (
1.19
)
mime-types (
2.2
)
mongo (1.6.4)
bson (~> 1.6.4)
mongoid (3.0.15)
...
...
@@ -99,7 +99,7 @@ GEM
origin (~> 1.0)
tzinfo (~> 0.3.22)
moped (1.5.1)
multi_json (1.
8
.2)
multi_json (1.
9
.2)
newrelic_moped (0.0.6)
moped
newrelic_rpm (~> 3.6.0)
...
...
@@ -121,7 +121,7 @@ GEM
rack (>= 1.0)
rack-timeout (0.1.0beta3)
raindrops (0.10.0)
rake (
0.9
.2.2)
rake (
10
.2.2)
rdiscount (1.6.8)
rest-client (1.6.7)
mime-types (>= 1.16)
...
...
@@ -148,7 +148,7 @@ GEM
tilt (~> 1.1, != 1.3.0)
thor (0.16.0)
tilt (1.3.3)
tire (0.
4
.2)
tire (0.
5
.2)
activemodel (>= 3.0)
hashr (~> 0.0.19)
multi_json (~> 1.0)
...
...
@@ -202,7 +202,7 @@ DEPENDENCIES
rspec
simplecov
sinatra
tire
tire
(= 0.5.2)
tire-contrib
unicorn
voteable_mongo!
...
...
app.rb
View file @
78c8e6b8
...
...
@@ -192,7 +192,7 @@ get '/heartbeat' do
es_ok
=
false
begin
es_status
=
get_es_status
es_ok
=
(
es_status
[
"ok"
]
==
true
and
es_status
[
"status"
]
==
200
)
es_ok
=
es_status
[
"status"
]
==
200
rescue
end
error
500
,
JSON
.
generate
({
"OK"
=>
false
,
"check"
=>
"es"
})
unless
es_ok
...
...
models/comment_thread.rb
View file @
78c8e6b8
...
...
@@ -98,7 +98,7 @@ class CommentThread < Content
search
=
Tire
::
Search
::
Search
.
new
'comment_threads'
search
.
query
{
|
query
|
query
.
text
:_all
,
params
[
"text"
]}
if
params
[
"text"
]
search
.
query
{
|
query
|
query
.
match
:_all
,
params
[
"text"
]}
if
params
[
"text"
]
search
.
highlight
({
title:
{
number_of_fragments:
0
}
}
,
{
body:
{
number_of_fragments:
0
}
},
options:
{
tag:
"<highlight>"
})
search
.
filter
(
:term
,
commentable_id:
params
[
"commentable_id"
])
if
params
[
"commentable_id"
]
search
.
filter
(
:terms
,
commentable_id:
params
[
"commentable_ids"
])
if
params
[
"commentable_ids"
]
...
...
@@ -126,7 +126,7 @@ class CommentThread < Content
if
params
[
"text"
]
search
=
Tire
::
Search
::
Search
.
new
'comments'
search
.
query
{
|
query
|
query
.
text
:_all
,
params
[
"text"
]}
if
params
[
"text"
]
search
.
query
{
|
query
|
query
.
match
:_all
,
params
[
"text"
]}
if
params
[
"text"
]
search
.
filter
(
:term
,
course_id:
params
[
"course_id"
])
if
params
[
"course_id"
]
search
.
size
CommentService
.
config
[
"max_deep_search_comment_count"
].
to_i
...
...
spec/app_spec.rb
View file @
78c8e6b8
...
...
@@ -106,15 +106,11 @@ describe "app" do
end
it
"reports success when es is ready"
do
test_es_check
({
"ok"
=>
true
,
"status"
=>
200
},
true
)
end
it
"reports failure when es is not ok"
do
test_es_check
({
"ok"
=>
false
,
"status"
=>
200
},
false
)
test_es_check
({
"status"
=>
200
},
true
)
end
it
"reports failure when es status is unexpected"
do
test_es_check
({
"
ok"
=>
true
,
"status"
=>
201
},
false
)
test_es_check
({
"
status"
=>
503
},
false
)
end
it
"reports failure when es status is malformed"
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