picky 0.10.1 → 0.10.2

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.
@@ -67,6 +67,10 @@ module Cacher
67
67
  end
68
68
 
69
69
  end
70
+
71
+ # ... aka Phonetic.
72
+ #
73
+ Phonetic = DoubleLevenshtone
70
74
 
71
75
  end
72
76
 
@@ -27,13 +27,14 @@ class PickySearch < Application
27
27
  books_index = index :books,
28
28
  Sources::CSV.new(:title, :author, :isbn, :year, :publisher, :subjects, file: 'app/library.csv'),
29
29
  category(:title,
30
- partial: Partial::Substring.new(from: 1), # Indexes substrings upwards from character 1 (default: -3),
30
+ similarity: Similarity::Phonetic.new(3)), # Up to three similar title word indexed (default: No similarity).
31
+ partial: Partial::Substring.new(from: 1) # Indexes substrings upwards from character 1 (default: -3),
31
32
  # You'll find "picky" even when entering just a "p".
32
- similarity: Similarity::DoubleLevenshtone.new(3)), # Up to three similar title word indexed (default: No similarity).
33
33
  category(:author,
34
34
  partial: Partial::Substring.new(from: 1)),
35
35
  category(:isbn,
36
- partial: Partial::None.new) # Partial substring searching on an ISBN makes not much sense, neither does similarity.
36
+ partial: Partial::None.new) # Partial substring searching on an ISBN does not make
37
+ # much sense, neither does similarity.
37
38
 
38
39
  query_options = { :weights => { [:title, :author] => +3, [:title] => +1 } } # +/- points for ordered combinations.
39
40
 
@@ -56,5 +56,11 @@ describe Cacher::Similarity::DoubleLevenshtone do
56
56
  index[code].should == [:mair, :maier, :meier, :meira, :mairai]
57
57
  end
58
58
  end
59
+
60
+ context "alias" do
61
+ it "works also with Phonetic" do
62
+ lambda { Cacher::Similarity::Phonetic.new(1) }.should_not raise_error
63
+ end
64
+ end
59
65
 
60
66
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 10
8
- - 1
9
- version: 0.10.1
8
+ - 2
9
+ version: 0.10.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Florian Hanke