estella 0.3.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d881bd248152b83758455a9116ea0c56e382d279
4
- data.tar.gz: 31d2a0d826ab272ad92627ddd68b10b6ab74d07b
3
+ metadata.gz: 005678de72fb7aef97a46d6cbc64d198ea6104cb
4
+ data.tar.gz: d9dae12511d40cd83781a63946e0bf00c500165b
5
5
  SHA512:
6
- metadata.gz: 8c60f3f41f1b4baae0fb677034f8edd524e5f14d40761da4f5484f51e9497ff304c6092e2c6d121c129c06462f48e6511ba35314380c21b6708a27fcdc4e6a88
7
- data.tar.gz: 1389d0798d01f143d7a9640dc4eba8d367b2fe11e14329d1aa03b90127a2f697b69067c6bfaab946198e4f3a9fa1068100b1d5e2fd257496575a20d2e7f8246c
6
+ metadata.gz: da680ba976b1deb2ccc3a88185caaf3a95e36e0523da8fe9f29ddd1a085e33f56ede8a2deef3b7d48bf3386828c88fd37f26428f1cf36876bce4e69691a1f785
7
+ data.tar.gz: c2bd518ae2d407d72cdc78e130b63873c2dee8889987e81e481395a54abb771e4ba514304aeb59361c8e5af2ef1fa6dbc7d8097ef9a0ea4581d4c942abda4e16
data/.travis.yml CHANGED
@@ -2,12 +2,20 @@ language: ruby
2
2
 
3
3
  cache: bundler
4
4
 
5
- rvm:
6
- - 2.2.2
5
+ before_script:
6
+ - bundle exec danger
7
+
8
+ env:
9
+ - ELASTICSEARCH=https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.4.5/elasticsearch-2.4.5.deb
10
+ - ELASTICSEARCH=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.6.deb
7
11
 
8
12
  before_install:
13
+ - gem update --system
9
14
  - gem update bundler
10
- - "curl -O https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.1.1/elasticsearch-2.1.1.deb && sudo dpkg -i --force-confnew elasticsearch-2.1.1.deb"
15
+ - curl -O $ELASTICSEARCH && sudo dpkg -i --force-confnew elasticsearch-*.deb
11
16
  - "echo 'script.inline: on' | sudo tee -a /etc/elasticsearch/elasticsearch.yml"
12
- - "sudo /etc/init.d/elasticsearch start"
13
- - "sleep 5"
17
+ - sudo /etc/init.d/elasticsearch start
18
+ - until curl --silent -XGET --fail http://localhost:9200; do printf '.'; sleep 1; done
19
+
20
+ rvm:
21
+ - 2.3.1
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ## Changelog
2
2
 
3
- ### 0.3.0 (Next)
3
+ ### 2.0.0
4
+
5
+ * [#25](https://github.com/artsy/estella/pull/25): Support ElasticSearch 1.5.x - [@dblock](https://github.com/dblock).
6
+ * [#21](https://github.com/artsy/estella/pull/21): Added Danger, PR linter - [@dblock](https://github.com/dblock).
7
+ * [#20](https://github.com/artsy/estella/pull/20): Documented ES compatibility with 2.x - [@cavvia](https://github.com/cavvia).
8
+
9
+ ### 0.3.0 (1/29/2017)
4
10
 
5
11
  * [#15](https://github.com/artsy/estella/pull/15): Removed undocumented `set_index_alias!` - [@dblock](https://github.com/dblock).
6
12
  * [#15](https://github.com/artsy/estella/pull/15): Added `delete_index!` and `create_index!` - [@dblock](https://github.com/dblock).
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,125 @@
1
+ # Contributing to Estella
2
+
3
+ This project is work of [many contributors](https://github.com/artsy/estella/graphs/contributors).
4
+
5
+ You're encouraged to submit [pull requests](https://github.com/artsy/estella/pulls), [propose features and discuss issues](https://github.com/artsy/estella/issues).
6
+
7
+ In the examples below, substitute your Github username for `contributor` in URLs.
8
+
9
+ ### Fork the Project
10
+
11
+ Fork the [project on Github](https://github.com/artsy/estella) and check out your copy.
12
+
13
+ ```
14
+ git clone https://github.com/contributor/estella.git
15
+ cd estella
16
+ git remote add upstream https://github.com/artsy/estella.git
17
+ ```
18
+
19
+ ### Bundle Install and Test
20
+
21
+ Ensure that you can build the project and run tests.
22
+
23
+ ```
24
+ bundle install
25
+ bundle exec rake
26
+ ```
27
+
28
+ ## Contribute Code
29
+
30
+ ### Create a Topic Branch
31
+
32
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
33
+
34
+ ```
35
+ git checkout master
36
+ git pull upstream master
37
+ git checkout -b my-feature-branch
38
+ ```
39
+
40
+ ### Write Tests
41
+
42
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add tests to [spec](spec).
43
+
44
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
45
+
46
+ ### Write Code
47
+
48
+ Implement your feature or bug fix.
49
+
50
+ Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ingored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
51
+
52
+ Make sure that `bundle exec rake` completes without errors.
53
+
54
+ ### Write Documentation
55
+
56
+ Document any external behavior in the [README](README.md).
57
+
58
+ ### Update Changelog
59
+
60
+ Add a line to [CHANGELOG](CHANGELOG.md) under *Next*. Don't remove *Your contribution here*.
61
+
62
+ Make it look like every other line, including a link to the issue being fixed, your name and link to your Github account.
63
+
64
+ ### Commit Changes
65
+
66
+ Make sure git knows your name and email address:
67
+
68
+ ```
69
+ git config --global user.name "Your Name"
70
+ git config --global user.email "contributor@example.com"
71
+ ```
72
+
73
+ Writing good commit logs is important. A commit log should describe what changed and why.
74
+
75
+ ```
76
+ git add ...
77
+ git commit
78
+ ```
79
+
80
+ ### Push
81
+
82
+ ```
83
+ git push origin my-feature-branch
84
+ ```
85
+
86
+ ### Make a Pull Request
87
+
88
+ Go to https://github.com/contributor/estella and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
89
+
90
+ ### Update CHANGELOG Again
91
+
92
+ Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
93
+
94
+ ```
95
+ * [#123](https://github.com/artsy/estella/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
96
+ ```
97
+
98
+ Amend your previous commit and force push the changes.
99
+
100
+ ```
101
+ git commit --amend
102
+ git push origin my-feature-branch -f
103
+ ```
104
+
105
+ ### Rebase
106
+
107
+ If you've been working on a change for a while, rebase with upstream/master.
108
+
109
+ ```
110
+ git fetch upstream
111
+ git rebase upstream/master
112
+ git push origin my-feature-branch -f
113
+ ```
114
+
115
+ ### Check on Your Pull Request
116
+
117
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
118
+
119
+ ### Be Patient
120
+
121
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
122
+
123
+ ## Thank You
124
+
125
+ Please do know that we really appreciate and value your time and work. We love you, really.
data/Dangerfile ADDED
@@ -0,0 +1 @@
1
+ changelog.check
data/Gemfile CHANGED
@@ -4,4 +4,5 @@ gemspec
4
4
 
5
5
  group :development, :test do
6
6
  gem 'coveralls', '~> 0.8.17', require: false
7
+ gem 'danger-changelog', '~> 0.1.0'
7
8
  end
data/LICENSE CHANGED
@@ -1,13 +1,13 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 Artsy Inc.
3
+ Copyright (c) 2017 Art.sy, Inc.
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
data/README.md CHANGED
@@ -7,23 +7,35 @@
7
7
 
8
8
  Builds on [elasticsearch-model](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model) to make your Ruby objects searchable with Elasticsearch. Provides fine-grained control of fields, analysis, filters, weightings and boosts.
9
9
 
10
+ ## Compatibility
11
+
12
+ This library is compatible with [Elasticsearch 1.5.x, 2.x](https://www.elastic.co/products/elasticsearch) and currently does not work with Elasticsearch 5.x (see [#18](https://github.com/artsy/estella/issues/18)). It works with many ORM/ODMs, including ActiveRecord and Mongoid.
13
+
14
+ ## Dependencies
15
+
16
+ * [elasticsearch-model](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model)
17
+ * [ActiveSupport](https://github.com/rails/rails/tree/master/activesupport)
18
+ * [ActiveModel](https://github.com/rails/rails/tree/master/activemodel)
19
+
10
20
  ## Installation
11
21
 
12
22
  ```
13
23
  gem 'estella'
14
24
  ```
15
25
 
16
- The module will try to use Elasticsearch on `localhost:9200` by default. You can configure your global ES client like so:
26
+ Estella will try to use Elasticsearch on `localhost:9200` by default.
27
+
28
+ You can configure your global ElasticSearch client like so:
17
29
 
18
30
  ```ruby
19
31
  Elasticsearch::Model.client = Elasticsearch::Client.new host: 'foo.com', log: true
20
32
  ```
21
33
 
22
- It is also configurable on a per model basis, see the [doc](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model#the-elasticsearch-client).
34
+ It's also configurable on a per-model basis. Refer to the [ElasticSearch documentation](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model#the-elasticsearch-client) for details.
23
35
 
24
36
  ## Indexing
25
37
 
26
- Just include the `Estella::Searchable` module and add a `searchable` block in your ActiveRecord or Mongoid model declaring the fields to be indexed like so:
38
+ Include the `Estella::Searchable` module and add a `searchable` block in your model declaring the fields to be indexed.
27
39
 
28
40
  ```ruby
29
41
  class Artist < ActiveRecord::Base
@@ -41,7 +53,7 @@ class Artist < ActiveRecord::Base
41
53
  end
42
54
  ```
43
55
 
44
- For a full understanding of the options available for field mappings, see the Elastic [mapping documentation](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/mapping.html).
56
+ For a full list of the options available for field mappings, see the ElasticSearch [mapping documentation](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/mapping.html).
45
57
 
46
58
  The `filter` option allows the field to be used as a filter at search time.
47
59
 
@@ -90,10 +102,10 @@ end
90
102
  A number of class methods are available for indexing.
91
103
 
92
104
  ```
93
- # returns true if the index exists
105
+ # return true if the index exists
94
106
  Artist.index_exists?
95
107
 
96
- # creates the index
108
+ # create the index
97
109
  Artist.create_index!
98
110
 
99
111
  # delete and re-create the index without reindexing data
@@ -102,7 +114,7 @@ Artist.reload_index!
102
114
  # recreate the index and reindex all data
103
115
  Artist.recreate_index!
104
116
 
105
- # deletes the index
117
+ # delete the index
106
118
  Artist.delete_index!
107
119
 
108
120
  # commit any outstanding writes
@@ -111,19 +123,19 @@ Artist.refresh_index!
111
123
 
112
124
  ## Custom Analysis
113
125
 
114
- Estella defines `standard`, `snowball`, `ngram` and `shingle` analysers by default. These cover most search contexts, including auto-suggest. In order to enable full-text search for a field, use:
126
+ Estella defines `standard`, `snowball`, `ngram` and `shingle` analyzers by default. These cover most search contexts, including auto-suggest. In order to enable full-text search for a field, use:
115
127
 
116
128
  ```ruby
117
129
  analysis: Estella::Analysis::FULLTEXT_ANALYSIS
118
130
  ```
119
131
 
120
- Or alternatively select your analysis by listing the analysers you want enabled for a given field:
132
+ Or alternatively select your analysis by listing the analyzers you want enabled for a given field:
121
133
 
122
134
  ```ruby
123
- es_field :keywords, type: :string, analysis: ['snowball', 'shingle']
135
+ field :keywords, type: :string, analysis: ['snowball', 'shingle']
124
136
  ```
125
137
 
126
- The searchable block takes a `settings` hash in case you require custom analysers or sharding (see [doc](https://www.elastic.co/guide/en/elasticsearch/guide/current/configuring-analyzers.html)):
138
+ Estella default analyzer and sharding options are defined [here](lib/estella/analysis.rb) and can be customized by passing a `settings` hash to the `searchable` block.
127
139
 
128
140
  ```ruby
129
141
  my_analysis = {
@@ -148,18 +160,18 @@ searchable my_settings do
148
160
  end
149
161
  ```
150
162
 
151
- It will otherwise use Estella defaults.
163
+ See [configuring analyzers](https://www.elastic.co/guide/en/elasticsearch/guide/current/configuring-analyzers.html) for more information.
152
164
 
153
165
  ## Searching
154
166
 
155
- Finally perform full-text search:
167
+ Perform full-text search with `estella_search`:
156
168
 
157
169
  ```ruby
158
170
  Artist.estella_search(term: 'frank')
159
171
  Artist.estella_search(term: 'minimalism')
160
172
  ```
161
173
 
162
- Estella searches all analysed text fields by default, using a [multi_match](https://www.elastic.co/guide/en/elasticsearch/guide/current/multi-match-query.html) search. The search will return an array of database records in score order. If you'd like access to the raw Elasticsearch response data use the `raw` option:
174
+ Estella searches all analyzed text fields by default, using a [multi_match](https://www.elastic.co/guide/en/elasticsearch/guide/current/multi-match-query.html) search. The search will return an array of database records, ordered by score. If you'd like access to the raw Elasticsearch response data use the `raw` option:
163
175
 
164
176
  ```ruby
165
177
  Artist.estella_search(term: 'frank', raw: true)
@@ -172,13 +184,13 @@ Artist.estella_search(term: 'frank', published: true)
172
184
  Artist.estella_search(term: 'frank', size: 10, from: 5)
173
185
  ```
174
186
 
175
- You can exclude records.
187
+ You can exclude records:
176
188
 
177
189
  ```ruby
178
190
  Artist.estella_search(term: 'frank', exclude: { keywords: 'sinatra' })
179
191
  ```
180
192
 
181
- If you'd like to customize your query further, you can extend `Estella::Query` and override `query_definition` and `field_factors`:
193
+ If you'd like to customize your term query further, you can extend `Estella::Query` and override `query_definition` and `field_factors`:
182
194
 
183
195
  ```ruby
184
196
  class MyQuery < Estella::Query
@@ -202,16 +214,16 @@ class MyQuery < Estella::Query
202
214
  end
203
215
  ```
204
216
 
205
- Or manipulate the query in the initializer directly via `query` or using built-in helpers `must` and `exclude`.
217
+ Or manipulate the query for all cases (with or without `term`) in the initializer directly via `query` or by using built-in helpers `must` and `exclude`.
206
218
 
207
219
  ```ruby
208
220
  class MyQuery < Estella::Query
209
221
  def initialize(params)
210
222
  super
211
223
  # same as query[:filter][:bool][:must] = { keywords: 'frank' }
212
- must term: { keywords: 'frank' }
224
+ must(term: { keywords: 'frank' })
213
225
  # same as query[:filter][:bool][:must_not] = { keywords: 'sinatra' }
214
- exclude term: { keywords: 'sinatra' }
226
+ exclude(term: { keywords: 'sinatra' })
215
227
  end
216
228
  end
217
229
  ```
@@ -231,17 +243,15 @@ class Artist < ActiveRecord::Base
231
243
  end
232
244
  end
233
245
 
234
- Artist.estella_search (term: 'frank')
246
+ Artist.estella_search(term: 'frank')
235
247
  ```
236
248
 
237
- For further search customization, see the [elasticsearch dsl](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model#the-elasticsearch-dsl).
238
-
239
- Estella works with any ActiveRecord or Mongoid compatible data models.
249
+ For further search customization, see the [ElasticSearch DSL](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-model#the-elasticsearch-dsl).
240
250
 
241
251
  ## Contributing
242
252
 
243
- Just fork the repo and submit a pull request.
253
+ See [CONTRIBUTING](CONTRIBUTING.md).
244
254
 
245
255
  ## License
246
256
 
247
- Copyright (c) 2017 Artsy Inc., [MIT License](LICENSE).
257
+ MIT License. See [LICENSE](LICENSE).
data/Rakefile CHANGED
@@ -13,4 +13,4 @@ end
13
13
  require 'rubocop/rake_task'
14
14
  RuboCop::RakeTask.new(:rubocop)
15
15
 
16
- task default: [:rubocop, :spec]
16
+ task default: %i[rubocop spec]
data/estella.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
1
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
2
2
  require 'estella/version'
3
3
 
4
4
  Gem::Specification.new do |gem|
@@ -14,14 +14,14 @@ Gem::Specification.new do |gem|
14
14
  gem.files = `git ls-files`.split("\n")
15
15
  gem.test_files = `git ls-files -- spec/*`.split("\n")
16
16
 
17
- gem.add_runtime_dependency 'elasticsearch-model'
18
- gem.add_runtime_dependency 'activesupport'
19
17
  gem.add_runtime_dependency 'activemodel'
18
+ gem.add_runtime_dependency 'activesupport'
19
+ gem.add_runtime_dependency 'elasticsearch-model', '~> 2.0'
20
20
 
21
- gem.add_development_dependency 'rake', '~> 11.0'
22
21
  gem.add_development_dependency 'activerecord'
22
+ gem.add_development_dependency 'rake', '~> 11.0'
23
23
  gem.add_development_dependency 'rspec', '~> 3.1.0'
24
24
  gem.add_development_dependency 'rspec-expectations'
25
+ gem.add_development_dependency 'rubocop', '0.60.0'
25
26
  gem.add_development_dependency 'sqlite3'
26
- gem.add_development_dependency 'rubocop', '0.47.1'
27
27
  end
@@ -7,16 +7,16 @@ module Estella
7
7
  { type: 'edgeNGram', min_gram: 2, max_gram: 15, side: 'front' }
8
8
 
9
9
  DEFAULT_ANALYZER =
10
- { type: 'custom', tokenizer: 'standard_tokenizer', filter: %w(lowercase asciifolding) }
10
+ { type: 'custom', tokenizer: 'standard_tokenizer', filter: %w[lowercase asciifolding] }
11
11
 
12
12
  SNOWBALL_ANALYZER =
13
- { type: 'custom', tokenizer: 'standard_tokenizer', filter: %w(lowercase asciifolding snowball) }
13
+ { type: 'custom', tokenizer: 'standard_tokenizer', filter: %w[lowercase asciifolding snowball] }
14
14
 
15
15
  SHINGLE_ANALYZER =
16
- { type: 'custom', tokenizer: 'standard_tokenizer', filter: %w(shingle lowercase asciifolding) }
16
+ { type: 'custom', tokenizer: 'standard_tokenizer', filter: %w[shingle lowercase asciifolding] }
17
17
 
18
18
  NGRAM_ANALYZER =
19
- { type: 'custom', tokenizer: 'standard_tokenizer', filter: %w(lowercase asciifolding front_ngram_filter) }
19
+ { type: 'custom', tokenizer: 'standard_tokenizer', filter: %w[lowercase asciifolding front_ngram_filter] }
20
20
 
21
21
  DEFAULT_ANALYSIS = {
22
22
  tokenizer: {
@@ -26,11 +26,11 @@ module Estella
26
26
  front_ngram_filter: FRONT_NGRAM_FILTER
27
27
  },
28
28
  analyzer: {
29
- default_analyzer: DEFAULT_ANALYZER,
30
- snowball_analyzer: SNOWBALL_ANALYZER,
31
- shingle_analyzer: SHINGLE_ANALYZER,
32
- ngram_analyzer: NGRAM_ANALYZER,
33
- search_analyzer: DEFAULT_ANALYZER
29
+ default_analyzer: DEFAULT_ANALYZER,
30
+ snowball_analyzer: SNOWBALL_ANALYZER,
31
+ shingle_analyzer: SHINGLE_ANALYZER,
32
+ ngram_analyzer: NGRAM_ANALYZER,
33
+ search_analyzer: DEFAULT_ANALYZER
34
34
  }
35
35
  }
36
36
 
@@ -8,9 +8,8 @@ module Estella
8
8
  # @see https://www.elastic.co/guide/en/elasticsearch/guide/current/boosting-by-popularity.html
9
9
  def boost(name, opts = {})
10
10
  fail ArgumentError, 'Boost field is not indexed!' unless @model.indexed_fields.include? name
11
- unless (opts.keys & [:modifier, :factor]).length == 2
12
- fail ArgumentError, 'Please supply a modifier and a factor for your boost!'
13
- end
11
+ fail ArgumentError, 'Please supply a modifier and a factor for your boost!' unless (opts.keys & %i[modifier factor]).length == 2
12
+
14
13
  @model.field_boost = { boost: { field: name }.merge(opts) }
15
14
  end
16
15
 
data/lib/estella/query.rb CHANGED
@@ -80,6 +80,7 @@ module Estella
80
80
 
81
81
  max = boost[:max]
82
82
  return unless max
83
+
83
84
  query[:query][:function_score][:max_boost] = max
84
85
  end
85
86
 
@@ -101,8 +102,10 @@ module Estella
101
102
  def add_filters
102
103
  indexed_fields = params[:indexed_fields]
103
104
  return unless indexed_fields
105
+
104
106
  indexed_fields.each do |field, opts|
105
107
  next unless opts[:filter] && params[field]
108
+
106
109
  must term: { field => params[field] }
107
110
  end
108
111
  end
@@ -110,6 +113,7 @@ module Estella
110
113
  def add_excludes
111
114
  exclude = params[:exclude]
112
115
  return unless exclude
116
+
113
117
  exclude.each do |k, v|
114
118
  exclude(term: { k => v })
115
119
  end
@@ -1,3 +1,3 @@
1
1
  module Estella
2
- VERSION = '0.3.0'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -19,7 +19,7 @@ describe Estella::Searchable, type: :model do
19
19
 
20
20
  searchable do
21
21
  field :title, type: :string, analysis: Estella::Analysis::FULLTEXT_ANALYSIS, factor: 1.0
22
- field :keywords, type: :string, analysis: [:default, :snowball], factor: 0.5
22
+ field :keywords, type: :string, analysis: %i[default snowball], factor: 0.5
23
23
  field :follows_count, type: :integer
24
24
  field :published, type: :boolean, filter: true
25
25
 
@@ -75,7 +75,7 @@ describe Estella::Searchable, type: :model do
75
75
  it 'indexes slug field by default' do
76
76
  SearchableModel.create(title: 'liapunov', slug: 'liapunov')
77
77
  SearchableModel.refresh_index!
78
- expect(SearchableModel.mappings.to_hash[:searchable_model][:properties].keys.include?(:slug)).to eq true
78
+ expect(SearchableModel.mappings.to_hash[:searchable_model][:properties].key?(:slug)).to eq true
79
79
  end
80
80
  it 'supports boolean filters' do
81
81
  liapunov = SearchableModel.create(title: 'liapunov', published: true)
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,7 @@ require 'rspec'
5
5
  require 'coveralls'
6
6
  Coveralls.wear!
7
7
 
8
- require File.expand_path('../../lib/estella.rb', __FILE__)
8
+ require File.expand_path('../lib/estella.rb', __dir__)
9
9
 
10
10
  RSpec.configure do |config|
11
11
  config.raise_errors_for_deprecations!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: estella
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anil Bawa-Cavia
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-29 00:00:00.000000000 Z
12
+ date: 2019-08-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: elasticsearch-model
15
+ name: activemodel
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
@@ -40,47 +40,47 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: activemodel
43
+ name: elasticsearch-model
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: '2.0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ">="
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: '2.0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: rake
57
+ name: activerecord
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '11.0'
62
+ version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '11.0'
69
+ version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
- name: activerecord
71
+ name: rake
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">="
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: '11.0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0'
83
+ version: '11.0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -110,33 +110,33 @@ dependencies:
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  - !ruby/object:Gem::Dependency
113
- name: sqlite3
113
+ name: rubocop
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ">="
116
+ - - '='
117
117
  - !ruby/object:Gem::Version
118
- version: '0'
118
+ version: 0.60.0
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ">="
123
+ - - '='
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: 0.60.0
126
126
  - !ruby/object:Gem::Dependency
127
- name: rubocop
127
+ name: sqlite3
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 0.47.1
132
+ version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - '='
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 0.47.1
139
+ version: '0'
140
140
  description: Make your Ruby objects searchable with Elasticsearch.
141
141
  email:
142
142
  - anil@artsy.net
@@ -151,6 +151,8 @@ files:
151
151
  - ".rubocop_todo.yml"
152
152
  - ".travis.yml"
153
153
  - CHANGELOG.md
154
+ - CONTRIBUTING.md
155
+ - Dangerfile
154
156
  - Gemfile
155
157
  - LICENSE
156
158
  - README.md
@@ -186,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
188
  version: '0'
187
189
  requirements: []
188
190
  rubyforge_project:
189
- rubygems_version: 2.4.6
191
+ rubygems_version: 2.5.1
190
192
  signing_key:
191
193
  specification_version: 4
192
194
  summary: Make your Ruby objects searchable with Elasticsearch.