Skip to content

Commit 5bf8c86

Browse files
committed
Revert "Merge pull request #495 from cbdr/topic/COR-772-Upgrade-ES-to-5.x"
This reverts commit 39d2e07, reversing changes made to 2c57097.
1 parent 39d2e07 commit 5bf8c86

File tree

6 files changed

+13
-18
lines changed

6 files changed

+13
-18
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ gem 'rails', '~> 5.0.2'
1212

1313
# Cortex-specific
1414
gem 'cortex-exceptions', '= 0.0.4'
15-
gem 'cortex-plugins-core', '= 0.12.4'
15+
gem 'cortex-plugins-core', '= 0.12.3'
1616

1717
# API
1818
gem 'grape', '~> 0.17'

Gemfile.lock

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ GEM
136136
concurrent-ruby (1.0.5)
137137
connection_pool (2.2.1)
138138
cortex-exceptions (0.0.4)
139-
cortex-plugins-core (0.12.4)
139+
cortex-plugins-core (0.12.3)
140140
cells (~> 4.1)
141141
cells-haml (~> 0.0)
142142
cells-rails (~> 0.0)
@@ -172,7 +172,7 @@ GEM
172172
dotenv-rails (2.2.1)
173173
dotenv (= 2.2.1)
174174
railties (>= 3.2, < 5.2)
175-
down (2.5.1)
175+
down (2.4.3)
176176
elasticsearch (5.0.4)
177177
elasticsearch-api (= 5.0.4)
178178
elasticsearch-transport (= 5.0.4)
@@ -327,9 +327,8 @@ GEM
327327
json_spec (1.1.4)
328328
multi_json (~> 1.0)
329329
rspec (>= 2.0, < 4.0)
330-
jsonb_accessor (1.0.0.beta.6)
330+
jsonb_accessor (1.0.0.beta.4)
331331
activerecord (>= 5.0)
332-
activesupport (>= 5.0)
333332
pg (>= 0.18.1)
334333
kaminari (0.17.0)
335334
actionpack (>= 3.0.0)
@@ -619,7 +618,7 @@ DEPENDENCIES
619618
cells-rails (~> 0.0.7)
620619
codeclimate-test-reporter (~> 0.6)
621620
cortex-exceptions (= 0.0.4)
622-
cortex-plugins-core (= 0.12.4)
621+
cortex-plugins-core (= 0.12.3)
623622
database_cleaner (~> 1.5)
624623
deep_cloneable (~> 2.2.2)
625624
devise (~> 4.2.1)

app/models/concerns/searchable.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def range_search(field, type, q)
3535
def published_filter
3636
# Bring in documents based on Draft status, Published date met, or either: Expired date not yet met, or Expired date null
3737
[
38-
{bool: {must: [term_search(:draft, false)]}},
39-
{bool: {must: [range_search(:published_at, :lte, DateTime.now.to_s)]}},
40-
{bool: {should: [range_search(:expired_at, :gte, DateTime.now.to_s), {bool: {must_not: {exists: { field: :expired_at }}}}]}}
38+
{bool: {should: [term_search(:draft, false)]}},
39+
{bool: {should: [range_search(:published_at, :lte, DateTime.now.to_s)]}},
40+
{bool: {should: [range_search(:expired_at, :gte, DateTime.now.to_s), {missing: { field: :expired_at }}]}}
4141
]
4242
end
4343
end

app/models/concerns/searchable_post.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,25 +93,21 @@ def search_with_params(params, tenant, published = nil)
9393
if author
9494
bool[:bool][:filter] << term_search(:author, author)
9595
end
96-
9796
if published
9897
bool[:bool][:filter] << published_filter
99-
search query: bool, sort: [{is_sticky: {order: 'desc'}, published_at: {order: 'desc'}}]
100-
else
101-
search query: bool
10298
end
99+
100+
search query: bool
103101
end
104102

105103
def show_all(tenant, published = nil)
106104
bool = {bool: {filter: [{term: {tenant_id: tenant.id}}]}}
107105

108106
if published
109107
bool[:bool][:filter] << published_filter
110-
search query: bool, sort: [{is_sticky: {order: 'desc'}, published_at: {order: 'desc'}}]
111-
else
112-
search query: bool, sort: [{is_sticky: {order: 'desc'}, created_at: {order: 'desc'}}]
113108
end
114109

110+
search query: bool, sort: [{is_sticky: {order: 'desc'}, created_at: {order: 'desc'}}]
115111
end
116112
end
117113
end

app/models/content_item.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def method_missing(*args)
113113
"#{publish_state.downcase}?" == args[0].to_s
114114
else
115115
# Used to query for any field on the relevant ContentType and return data from the content_item
116-
field_items.select { |field_item| field_item.field.name.parameterize(separator: '_') == args[0].to_s }.first.data.values[0]
116+
field_items.select { |field_item| field_item.field.name.parameterize({ separator: '_' }) == args[0].to_s }.first.data.values[0]
117117
end
118118
end
119119
end

app/models/content_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def self.permissions
2525
end
2626

2727
def content_items_index_name
28-
content_type_name_sanitized = name.parameterize(separator: '_')
28+
content_type_name_sanitized = name.parameterize('_')
2929
"#{Rails.env}_content_type_#{content_type_name_sanitized}_content_items"
3030
end
3131

0 commit comments

Comments
 (0)