picky-generators 2.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,8 @@ gem 'yajl-ruby', '~> 0.8.1', :require => 'yajl'
12
12
 
13
13
  # Should be optional, but isn't yet. Sorry.
14
14
  #
15
- gem 'activerecord', '~> 2.3.8', :require => 'active_record'
15
+ gem 'activesupport', '~> 3.0', :require => 'active_support/core_ext'
16
+ gem 'activerecord', '~> 3.0', :require => 'active_record'
16
17
 
17
18
  # Optional. Makes rack faster.
18
19
  #
@@ -7,22 +7,22 @@
7
7
  #
8
8
  class PickySearch < Application
9
9
 
10
- # How text is indexed.
10
+ # How text is indexed. Move to Index block to make it index specific.
11
11
  #
12
- default_indexing removes_characters: /[^a-zA-Z0-9\s\/\-\"\&\.]/i,
13
- stopwords: /\b(and|the|of|it|in|for)\b/i,
14
- splits_text_on: /[\s\/\-\"\&\.]/
12
+ indexing removes_characters: /[^a-zA-Z0-9\s\/\-\"\&\.]/i,
13
+ stopwords: /\b(and|the|of|it|in|for)\b/i,
14
+ splits_text_on: /[\s\/\-\"\&\.]/
15
15
 
16
- # How query text is preprocessed.
16
+ # How query text is preprocessed. Move to Search block to make it search specific.
17
17
  #
18
- default_querying removes_characters: /[^a-zA-Z0-9\s\/\-\,\&\"\~\*\:]/i, # Picky needs control chars *"~: to pass through.
19
- stopwords: /\b(and|the|of|it|in|for)\b/i,
20
- splits_text_on: /[\s\/\-\,\&]+/,
21
- maximum_tokens: 5, # Amount of tokens used in a search (5 = default).
22
- substitutes_characters_with: CharacterSubstituters::WestEuropean.new # Normalizes special user input, Ä -> Ae, ñ -> n etc.
18
+ searching removes_characters: /[^a-zA-Z0-9\s\/\-\,\&\"\~\*\:]/i, # Picky needs control chars *"~: to pass through.
19
+ stopwords: /\b(and|the|of|it|in|for)\b/i,
20
+ splits_text_on: /[\s\/\-\,\&]+/,
21
+ maximum_tokens: 5, # Amount of tokens used in a search (5 = default).
22
+ substitutes_characters_with: CharacterSubstituters::WestEuropean.new # Normalizes special user input, Ä -> Ae, ñ -> n etc.
23
23
 
24
- library_src = Sources::CSV.new :title, :author, :year, file: 'app/library.csv'
25
- books_index = Index::Memory.new :books, library_src do
24
+ books_index = Index::Memory.new :books do
25
+ source Sources::CSV.new(:title, :author, :year, file: 'app/library.csv')
26
26
  category :title,
27
27
  similarity: Similarity::DoubleMetaphone.new(3), # Default is no similarity.
28
28
  partial: Partial::Substring.new(from: 1) # Default is from: -3.
@@ -30,6 +30,8 @@ class PickySearch < Application
30
30
  category :year, partial: Partial::None.new
31
31
  end
32
32
 
33
- route %r{\A/books\Z} => Search.new(books_index, :weights => { [:title, :author] => +3, [:title] => +1 })
33
+ route %r{\A/books\Z} => Search.new(books_index) do
34
+ boost [:title, :author] => +3, [:title] => +1
35
+ end
34
36
 
35
37
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: picky-generators
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.1.2
5
+ version: 2.2.0
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-04-11 00:00:00 +10:00
13
+ date: 2011-04-14 00:00:00 +10: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: 2.1.2
35
+ version: 2.2.0
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: 2.1.2
46
+ version: 2.2.0
47
47
  type: :runtime
48
48
  version_requirements: *id003
49
49
  description: Generators for Picky.