searchkick 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e401e21d2d4ea7d82ec4295c01d62fca206efd5a
4
- data.tar.gz: 85bbde0041479b1e5f102fbab24c73614d02cd79
3
+ metadata.gz: d8597f4228cb190f5e40a6cd1e9819925cb54647
4
+ data.tar.gz: b5c87544aabc35fdc1c1d9aa079c11cd19e2a367
5
5
  SHA512:
6
- metadata.gz: ecef9c2bfa8db0e3715c19a8b9bcf72206d8c0fd3a3d82dc1a9fb40e801a1dd158ecf3aaf8e9dad832d5c7b0331e4ab3596fdab134bc92dd429d015c5c60557b
7
- data.tar.gz: 2fcff5e66e5c5e4e66a9a3cf150f3a9f386ef232098a69f4ec3d58d6d3ef5e599d7c651579937721cfe66e8edda93d2d438dd86bfbc76056df8c9e7624ed853c
6
+ metadata.gz: 9ede2a96713154c701adfdf8f2650ae3e88846fb8b01843f7c65b5abea8c1e0d97b96239773a2bec52e835f646d343c1cf76aacca95dc040f5f95069c1f884a3
7
+ data.tar.gz: 15b4b765bf82bd96272a78a45253f2df37a500ae8832c41301dc009a715eeae96d19ca5c53487740a82ba39c6a80312d5bfbed658e1c880229665e744ff88f7d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.7
2
+
3
+ - Added limit to facet
4
+ - Improved similar items
5
+
1
6
  ## 0.2.6
2
7
 
3
8
  - Added option to disable misspellings
data/README.md CHANGED
@@ -337,7 +337,7 @@ p products.facets
337
337
  Advanced
338
338
 
339
339
  ```ruby
340
- Product.search "2% Milk", facets: {store_id: {where: {in_stock: true}}}
340
+ Product.search "2% Milk", facets: {store_id: {where: {in_stock: true}, limit: 10}}
341
341
  ```
342
342
 
343
343
  ### Similar Items
@@ -513,8 +513,9 @@ View the [changelog](https://github.com/ankane/searchkick/blob/master/CHANGELOG.
513
513
 
514
514
  ## Contributing
515
515
 
516
- 1. Fork it
517
- 2. Create your feature branch (`git checkout -b my-new-feature`)
518
- 3. Commit your changes (`git commit -am 'Add some feature'`)
519
- 4. Push to the branch (`git push origin my-new-feature`)
520
- 5. Create new Pull Request
516
+ Everyone is encouraged to help improve this project. Here are a few ways you can help:
517
+
518
+ - [Report bugs](https://github.com/ankane/searchkick/issues)
519
+ - Fix bugs and [submit pull requests](https://github.com/ankane/searchkick/pulls)
520
+ - Write, clarify, or fix documentation
521
+ - Suggest or add new features
@@ -41,7 +41,8 @@ module Searchkick
41
41
  fields: fields,
42
42
  like_text: term,
43
43
  min_doc_freq: 1,
44
- min_term_freq: 1
44
+ min_term_freq: 1,
45
+ analyzer: "searchkick_search2"
45
46
  }
46
47
  }
47
48
  elsif all
@@ -233,10 +234,14 @@ module Searchkick
233
234
  facets.each do |field, facet_options|
234
235
  payload[:facets][field] = {
235
236
  terms: {
236
- field: field
237
+ field: field,
238
+ size: facet_options[:limit] || 100000
237
239
  }
238
240
  }
239
241
 
242
+ # offset is not possible
243
+ # http://elasticsearch-users.115913.n3.nabble.com/Is-pagination-possible-in-termsStatsFacet-td3422943.html
244
+
240
245
  facet_filters = where_filters.call(facet_options[:where])
241
246
  if facet_filters
242
247
  payload[:facets][field][:facet_filter] = {
@@ -1,3 +1,3 @@
1
1
  module Searchkick
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
data/test/facets_test.rb CHANGED
@@ -19,4 +19,8 @@ class TestFacets < Minitest::Unit::TestCase
19
19
  assert_equal 1, Product.search("Product", facets: {store_id: {where: {in_stock: true}}}).facets["store_id"]["terms"].size
20
20
  end
21
21
 
22
+ def test_limit
23
+ assert_equal 1, Product.search("Product", facets: {store_id: {limit: 1}}).facets["store_id"]["terms"].size
24
+ end
25
+
22
26
  end
data/test/similar_test.rb CHANGED
@@ -2,9 +2,19 @@ require_relative "test_helper"
2
2
 
3
3
  class TestSimilar < Minitest::Unit::TestCase
4
4
 
5
+ def test_similar
6
+ store_names ["Annie's Naturals Organic Shiitake & Sesame Dressing"]
7
+ assert_search "Annie's Naturals Shiitake & Sesame Vinaigrette", ["Annie's Naturals Organic Shiitake & Sesame Dressing"], similar: true
8
+ end
9
+
5
10
  def test_fields
6
11
  store_names ["1% Organic Milk", "2% Organic Milk", "Popcorn"]
7
12
  assert_equal ["2% Organic Milk"], Product.where(name: "1% Organic Milk").first.similar(fields: ["name"]).map(&:name)
8
13
  end
9
14
 
15
+ def test_order
16
+ store_names ["Lucerne Milk Chocolate Fat Free", "Clover Fat Free Milk"]
17
+ assert_order "Lucerne Fat Free Chocolate Milk", ["Lucerne Milk Chocolate Fat Free", "Clover Fat Free Milk"], similar: true
18
+ end
19
+
10
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2013-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tire