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.
@@ -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
|
-
|
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
|
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
|