picky-generators 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,10 +23,10 @@ class PickySearch < Application
23
23
  maximum_tokens: 5, # Amount of tokens passing into a query (5 = default).
24
24
  substitutes_characters_with: CharacterSubstituters::WestEuropean.new # Normalizes special user input, Ä -> Ae, ñ -> n etc.
25
25
 
26
- # Define an index. Use a database etc. source?
26
+ # Define an index. Use a database etc. source? Use an in-memory index or Redis?
27
27
  # See http://github.com/floere/picky/wiki/Sources-Configuration#sources
28
28
  #
29
- books_index = index :books, Sources::CSV.new(:title, :author, :year, file: 'app/library.csv')
29
+ books_index = Index::Memory.new :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),
@@ -39,11 +39,11 @@ class PickySearch < Application
39
39
 
40
40
  query_options = { :weights => { [:title, :author] => +3, [:title] => +1 } } # +/- points for ordered combinations.
41
41
 
42
- full_books = Query::Full.new books_index, query_options # A Full query returns ids, combinations, and counts.
43
- live_books = Query::Live.new books_index, query_options # A Live query does return all that Full returns, except ids.
44
-
45
- route %r{\A/books/full\Z} => full_books # Routing is simple: url_path_regexp => query
46
- route %r{\A/books/live\Z} => live_books #
42
+ # A Full query returns ids, combinations, and counts.
43
+ # A Live query does return all that Full returns, except ids.
44
+ #
45
+ route %r{\A/books/full\Z} => Query::Full.new(books_index, query_options) # Routing is simple:
46
+ route %r{\A/books/live\Z} => Query::Live.new(books_index, query_options) # url_path_regexp => query
47
47
 
48
48
  # Note: You can pass a query multiple indexes and it will query in all of them.
49
49
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: picky-generators
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.1
5
+ version: 1.4.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Florian Hanke
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-19 00:00:00 +01:00
13
+ date: 2011-02-28 00:00:00 +01:00
14
14
  default_executable: picky-generate
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirements:
33
33
  - - ~>
34
34
  - !ruby/object:Gem::Version
35
- version: 1.4.1
35
+ version: 1.4.2
36
36
  type: :runtime
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: 1.4.1
46
+ version: 1.4.2
47
47
  type: :runtime
48
48
  version_requirements: *id003
49
49
  description: Generators for Picky.