picky 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -26,10 +26,9 @@ module Indexed
|
|
26
26
|
@exact = exact_lambda.call(@exact, @partial) if exact_lambda = options[:exact_lambda]
|
27
27
|
@partial = partial_lambda.call(@exact, @partial) if partial_lambda = options[:partial_lambda]
|
28
28
|
|
29
|
-
# Extract?
|
29
|
+
# TODO Extract?
|
30
30
|
#
|
31
|
-
|
32
|
-
Query::Qualifiers.add(configuration.category_name, qualifiers) if qualifiers
|
31
|
+
Query::Qualifiers.add(configuration.category_name, generate_qualifiers_from(options) || [name])
|
33
32
|
end
|
34
33
|
|
35
34
|
# TODO Move to Index.
|
@@ -26,15 +26,15 @@ class PickySearch < Application
|
|
26
26
|
# Define an index. Use a database etc. source?
|
27
27
|
# See http://github.com/floere/picky/wiki/Sources-Configuration#sources
|
28
28
|
#
|
29
|
-
books_index = index :books, Sources::CSV.new(:title, :author, :
|
29
|
+
books_index = index :books, Sources::CSV.new(:title, :author, :year, file: 'app/library.csv')
|
30
30
|
books_index.define_category :title,
|
31
31
|
similarity: Similarity::Phonetic.new(3), # Up to three similar title word indexed (default: No similarity).
|
32
32
|
partial: Partial::Substring.new(from: 1) # Indexes substrings upwards from character 1 (default: -3),
|
33
33
|
# You'll find "picky" even when entering just a "p".
|
34
34
|
books_index.define_category :author,
|
35
35
|
partial: Partial::Substring.new(from: 1)
|
36
|
-
books_index.define_category :
|
37
|
-
partial: Partial::None.new # Partial substring searching on
|
36
|
+
books_index.define_category :year,
|
37
|
+
partial: Partial::None.new # Partial substring searching on the year does not make
|
38
38
|
# much sense, neither does similarity.
|
39
39
|
|
40
40
|
query_options = { :weights => { [:title, :author] => +3, [:title] => +1 } } # +/- points for ordered combinations.
|