elasticsearch-model 6.1.1 → 7.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/Gemfile +18 -1
  4. data/LICENSE.txt +199 -10
  5. data/README.md +44 -45
  6. data/Rakefile +24 -10
  7. data/elasticsearch-model.gemspec +54 -39
  8. data/examples/activerecord_article.rb +17 -0
  9. data/examples/activerecord_associations.rb +33 -0
  10. data/examples/activerecord_custom_analyzer.rb +17 -0
  11. data/examples/activerecord_mapping_completion.rb +17 -0
  12. data/examples/activerecord_mapping_edge_ngram.rb +17 -0
  13. data/examples/couchbase_article.rb +17 -0
  14. data/examples/datamapper_article.rb +17 -0
  15. data/examples/mongoid_article.rb +17 -0
  16. data/examples/ohm_article.rb +17 -0
  17. data/examples/riak_article.rb +17 -0
  18. data/gemfiles/3.0.gemfile +18 -1
  19. data/gemfiles/4.0.gemfile +18 -1
  20. data/gemfiles/5.0.gemfile +18 -1
  21. data/gemfiles/6.0.gemfile +21 -3
  22. data/lib/elasticsearch/model.rb +25 -60
  23. data/lib/elasticsearch/model/adapter.rb +17 -0
  24. data/lib/elasticsearch/model/adapters/active_record.rb +17 -0
  25. data/lib/elasticsearch/model/adapters/default.rb +17 -0
  26. data/lib/elasticsearch/model/adapters/mongoid.rb +17 -0
  27. data/lib/elasticsearch/model/adapters/multiple.rb +29 -4
  28. data/lib/elasticsearch/model/callbacks.rb +17 -0
  29. data/lib/elasticsearch/model/client.rb +17 -0
  30. data/lib/elasticsearch/model/ext/active_record.rb +17 -0
  31. data/lib/elasticsearch/model/hash_wrapper.rb +17 -0
  32. data/lib/elasticsearch/model/importing.rb +60 -16
  33. data/lib/elasticsearch/model/indexing.rb +69 -43
  34. data/lib/elasticsearch/model/multimodel.rb +17 -0
  35. data/lib/elasticsearch/model/naming.rb +19 -19
  36. data/lib/elasticsearch/model/proxy.rb +58 -21
  37. data/lib/elasticsearch/model/response.rb +17 -0
  38. data/lib/elasticsearch/model/response/aggregations.rb +17 -0
  39. data/lib/elasticsearch/model/response/base.rb +22 -1
  40. data/lib/elasticsearch/model/response/pagination.rb +17 -0
  41. data/lib/elasticsearch/model/response/pagination/kaminari.rb +17 -0
  42. data/lib/elasticsearch/model/response/pagination/will_paginate.rb +17 -0
  43. data/lib/elasticsearch/model/response/records.rb +17 -1
  44. data/lib/elasticsearch/model/response/result.rb +17 -0
  45. data/lib/elasticsearch/model/response/results.rb +17 -0
  46. data/lib/elasticsearch/model/response/suggestions.rb +17 -0
  47. data/lib/elasticsearch/model/searching.rb +17 -0
  48. data/lib/elasticsearch/model/serializing.rb +17 -0
  49. data/lib/elasticsearch/model/version.rb +18 -1
  50. data/spec/elasticsearch/model/adapter_spec.rb +17 -0
  51. data/spec/elasticsearch/model/adapters/active_record/associations_spec.rb +17 -0
  52. data/spec/elasticsearch/model/adapters/active_record/basic_spec.rb +281 -226
  53. data/spec/elasticsearch/model/adapters/active_record/dynamic_index_name_spec.rb +17 -0
  54. data/spec/elasticsearch/model/adapters/active_record/import_spec.rb +18 -12
  55. data/spec/elasticsearch/model/adapters/active_record/multi_model_spec.rb +17 -0
  56. data/spec/elasticsearch/model/adapters/active_record/namespaced_model_spec.rb +18 -1
  57. data/spec/elasticsearch/model/adapters/active_record/pagination_spec.rb +17 -0
  58. data/spec/elasticsearch/model/adapters/active_record/parent_child_spec.rb +18 -1
  59. data/spec/elasticsearch/model/adapters/active_record/serialization_spec.rb +17 -0
  60. data/spec/elasticsearch/model/adapters/active_record_spec.rb +17 -0
  61. data/spec/elasticsearch/model/adapters/default_spec.rb +17 -0
  62. data/spec/elasticsearch/model/adapters/mongoid/basic_spec.rb +17 -0
  63. data/spec/elasticsearch/model/adapters/mongoid/multi_model_spec.rb +28 -11
  64. data/spec/elasticsearch/model/adapters/mongoid_spec.rb +17 -0
  65. data/spec/elasticsearch/model/adapters/multiple_spec.rb +17 -0
  66. data/spec/elasticsearch/model/callbacks_spec.rb +17 -0
  67. data/spec/elasticsearch/model/client_spec.rb +17 -0
  68. data/spec/elasticsearch/model/hash_wrapper_spec.rb +17 -0
  69. data/spec/elasticsearch/model/importing_spec.rb +29 -0
  70. data/spec/elasticsearch/model/indexing_spec.rb +111 -15
  71. data/spec/elasticsearch/model/module_spec.rb +18 -25
  72. data/spec/elasticsearch/model/multimodel_spec.rb +17 -0
  73. data/spec/elasticsearch/model/naming_spec.rb +22 -5
  74. data/spec/elasticsearch/model/proxy_spec.rb +17 -0
  75. data/spec/elasticsearch/model/response/aggregations_spec.rb +17 -0
  76. data/spec/elasticsearch/model/response/base_spec.rb +17 -0
  77. data/spec/elasticsearch/model/response/pagination/kaminari_spec.rb +85 -23
  78. data/spec/elasticsearch/model/response/pagination/will_paginate_spec.rb +17 -0
  79. data/spec/elasticsearch/model/response/records_spec.rb +17 -0
  80. data/spec/elasticsearch/model/response/response_spec.rb +17 -0
  81. data/spec/elasticsearch/model/response/result_spec.rb +17 -0
  82. data/spec/elasticsearch/model/response/results_spec.rb +17 -0
  83. data/spec/elasticsearch/model/searching_search_request_spec.rb +17 -0
  84. data/spec/elasticsearch/model/searching_spec.rb +17 -0
  85. data/spec/elasticsearch/model/serializing_spec.rb +17 -0
  86. data/spec/spec_helper.rb +37 -5
  87. data/spec/support/app.rb +27 -2
  88. data/spec/support/app/answer.rb +17 -0
  89. data/spec/support/app/article.rb +17 -0
  90. data/spec/support/app/article_for_pagination.rb +17 -0
  91. data/spec/support/app/article_no_type.rb +37 -0
  92. data/spec/support/app/article_with_custom_serialization.rb +17 -0
  93. data/spec/support/app/article_with_dynamic_index_name.rb +17 -0
  94. data/spec/support/app/author.rb +17 -0
  95. data/spec/support/app/authorship.rb +17 -0
  96. data/spec/support/app/category.rb +17 -0
  97. data/spec/support/app/comment.rb +17 -0
  98. data/spec/support/app/episode.rb +17 -0
  99. data/spec/support/app/image.rb +17 -0
  100. data/spec/support/app/import_article.rb +17 -0
  101. data/spec/support/app/mongoid_article.rb +17 -0
  102. data/spec/support/app/namespaced_book.rb +17 -0
  103. data/spec/support/app/parent_and_child_searchable.rb +21 -4
  104. data/spec/support/app/post.rb +17 -0
  105. data/spec/support/app/question.rb +17 -0
  106. data/spec/support/app/searchable.rb +17 -0
  107. data/spec/support/app/series.rb +17 -0
  108. metadata +46 -46
  109. data/spec/elasticsearch/model/naming_inheritance_spec.rb +0 -184
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
 
3
20
  describe 'Elasticsearch::Model::Response::Response Kaminari' do
@@ -14,11 +31,6 @@ describe 'Elasticsearch::Model::Response::Response Kaminari' do
14
31
  remove_classes(ModelClass)
15
32
  end
16
33
 
17
- let(:response_document) do
18
- { 'took' => '5', 'timed_out' => false, '_shards' => {'one' => 'OK'},
19
- 'hits' => { 'total' => 100, 'hits' => (1..100).to_a.map { |i| { _id: i } } } }
20
- end
21
-
22
34
  let(:search) do
23
35
  Elasticsearch::Model::Searching::SearchRequest.new(model, '*')
24
36
  end
@@ -374,37 +386,87 @@ describe 'Elasticsearch::Model::Response::Response Kaminari' do
374
386
  end
375
387
  end
376
388
 
377
- context 'when the model is a single one' do
389
+ context 'when Elasticsearch version is < 7.0' do
378
390
 
379
- let(:model) do
380
- ModelClass
391
+ let(:response_document) do
392
+ { 'took' => '5', 'timed_out' => false, '_shards' => {'one' => 'OK'},
393
+ 'hits' => { 'total' => 100, 'hits' => (1..100).to_a.map { |i| { _id: i } } } }
381
394
  end
382
395
 
383
- let(:type_field) do
384
- 'bar'
385
- end
396
+ context 'when the model is a single one' do
386
397
 
387
- let(:index_field) do
388
- 'foo'
398
+ let(:model) do
399
+ ModelClass
400
+ end
401
+
402
+ let(:type_field) do
403
+ 'bar'
404
+ end
405
+
406
+ let(:index_field) do
407
+ 'foo'
408
+ end
409
+
410
+ it_behaves_like 'a search request that can be paginated'
389
411
  end
390
412
 
391
- it_behaves_like 'a search request that can be paginated'
392
- end
413
+ context 'when the model is a multimodel' do
414
+
415
+ let(:model) do
416
+ Elasticsearch::Model::Multimodel.new(ModelClass)
417
+ end
393
418
 
394
- context 'when the model is a multimodel' do
419
+ let(:type_field) do
420
+ ['bar']
421
+ end
422
+
423
+ let(:index_field) do
424
+ ['foo']
425
+ end
395
426
 
396
- let(:model) do
397
- Elasticsearch::Model::Multimodel.new(ModelClass)
427
+ it_behaves_like 'a search request that can be paginated'
398
428
  end
429
+ end
399
430
 
400
- let(:type_field) do
401
- ['bar']
431
+ context 'when Elasticsearch version is >= 7.0' do
432
+
433
+ let(:response_document) do
434
+ { 'took' => '5', 'timed_out' => false, '_shards' => {'one' => 'OK'},
435
+ 'hits' => { 'total' => { 'value' => 100, 'relation' => 'eq' }, 'hits' => (1..100).to_a.map { |i| { _id: i } } } }
402
436
  end
403
437
 
404
- let(:index_field) do
405
- ['foo']
438
+ context 'when the model is a single one' do
439
+
440
+ let(:model) do
441
+ ModelClass
442
+ end
443
+
444
+ let(:type_field) do
445
+ 'bar'
446
+ end
447
+
448
+ let(:index_field) do
449
+ 'foo'
450
+ end
451
+
452
+ it_behaves_like 'a search request that can be paginated'
406
453
  end
407
454
 
408
- it_behaves_like 'a search request that can be paginated'
455
+ context 'when the model is a multimodel' do
456
+
457
+ let(:model) do
458
+ Elasticsearch::Model::Multimodel.new(ModelClass)
459
+ end
460
+
461
+ let(:type_field) do
462
+ ['bar']
463
+ end
464
+
465
+ let(:index_field) do
466
+ ['foo']
467
+ end
468
+
469
+ it_behaves_like 'a search request that can be paginated'
470
+ end
409
471
  end
410
472
  end
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
 
3
20
  describe 'Elasticsearch::Model::Response::Response WillPaginate' do
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
 
3
20
  describe Elasticsearch::Model::Response::Records do
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
 
3
20
  describe Elasticsearch::Model::Response::Response do
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
  require 'active_support/json/encoding'
3
20
 
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
 
3
20
  describe Elasticsearch::Model::Response::Results do
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
 
3
20
  describe Elasticsearch::Model::Serializing do
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
 
3
20
  describe Elasticsearch::Model::Searching::ClassMethods do
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'spec_helper'
2
19
 
3
20
  describe Elasticsearch::Model::Serializing do
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'pry-nav'
2
19
  require 'kaminari'
3
20
  require 'kaminari/version'
@@ -6,7 +23,11 @@ require 'will_paginate/collection'
6
23
  require 'elasticsearch/model'
7
24
  require 'hashie/version'
8
25
  require 'active_model'
9
- require 'mongoid'
26
+ begin
27
+ require 'mongoid'
28
+ rescue LoadError
29
+ $stderr.puts("'mongoid' gem could not be loaded")
30
+ end
10
31
  require 'yaml'
11
32
  require 'active_record'
12
33
 
@@ -24,6 +45,7 @@ RSpec.configure do |config|
24
45
  tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" }
25
46
  Elasticsearch::Model.client = Elasticsearch::Client.new host: ELASTICSEARCH_URL,
26
47
  tracer: (ENV['QUIET'] ? nil : tracer)
48
+ puts "Elasticsearch Version: #{Elasticsearch::Model.client.info['version']}"
27
49
 
28
50
  unless ActiveRecord::Base.connected?
29
51
  ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ":memory:" )
@@ -59,8 +81,16 @@ end
59
81
  # @since 6.0.1
60
82
  def clear_indices(*models)
61
83
  models.each do |model|
62
- begin; Elasticsearch::Model.client.delete_by_query(index: model.index_name, q: '*'); rescue; end
63
- end and true
84
+ begin
85
+ Elasticsearch::Model.client.delete_by_query(
86
+ index: model.index_name,
87
+ q: '*',
88
+ body: {}
89
+ )
90
+ rescue
91
+ end
92
+ end
93
+ true
64
94
  end
65
95
 
66
96
  # Delete all documents from the tables of the provided list of models.
@@ -133,8 +163,10 @@ def test_mongoid?
133
163
  client.database.command(ping: 1) && true
134
164
  end
135
165
  end and true
136
- rescue Timeout::Error, LoadError, Mongo::Error => e
137
- client.close
166
+ rescue LoadError
167
+ $stderr.puts("'mongoid' gem could not be loaded")
168
+ rescue Timeout::Error, Mongo::Error => e
169
+ client.close if client
138
170
  $stderr.puts("MongoDB not installed or running: #{e}")
139
171
  end
140
172
  end
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'active_record'
2
19
 
3
20
  require 'support/app/question'
@@ -9,13 +26,21 @@ require 'support/app/namespaced_book'
9
26
  require 'support/app/article_for_pagination'
10
27
  require 'support/app/article_with_dynamic_index_name'
11
28
  require 'support/app/episode'
12
- require 'support/app/image'
13
29
  require 'support/app/series'
14
- require 'support/app/mongoid_article'
15
30
  require 'support/app/article'
31
+ require 'support/app/article_no_type'
16
32
  require 'support/app/searchable'
17
33
  require 'support/app/category'
18
34
  require 'support/app/author'
19
35
  require 'support/app/authorship'
20
36
  require 'support/app/comment'
21
37
  require 'support/app/post'
38
+
39
+
40
+ # Mongoid models
41
+ begin
42
+ require 'support/app/image'
43
+ require 'support/app/mongoid_article'
44
+ rescue
45
+ $stderr.puts("'mongoid' gem is not installed, could not load Mongoid models")
46
+ end
@@ -1,3 +1,20 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  class Answer < ActiveRecord::Base
2
19
  include Elasticsearch::Model
3
20