pollyanna 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  doc
2
2
  pkg
3
3
  *.gem
4
+ .idea
5
+
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '=2.3.8'
4
+ gem "pollyanna", :path => '.'
5
+ gem 'rspec', '=1.3.1'
6
+ gem 'rspec-rails', '=1.3.3'
7
+ gem 'ruby-debug'
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pollyanna (1.0.2)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ actionmailer (2.3.8)
10
+ actionpack (= 2.3.8)
11
+ actionpack (2.3.8)
12
+ activesupport (= 2.3.8)
13
+ rack (~> 1.1.0)
14
+ activerecord (2.3.8)
15
+ activesupport (= 2.3.8)
16
+ activeresource (2.3.8)
17
+ activesupport (= 2.3.8)
18
+ activesupport (2.3.8)
19
+ columnize (0.3.2)
20
+ linecache (0.43)
21
+ rack (1.1.0)
22
+ rails (2.3.8)
23
+ actionmailer (= 2.3.8)
24
+ actionpack (= 2.3.8)
25
+ activerecord (= 2.3.8)
26
+ activeresource (= 2.3.8)
27
+ activesupport (= 2.3.8)
28
+ rake (>= 0.8.3)
29
+ rake (0.8.7)
30
+ rspec (1.3.1)
31
+ rspec-rails (1.3.3)
32
+ rack (>= 1.0.0)
33
+ rspec (= 1.3.1)
34
+ ruby-debug (0.10.4)
35
+ columnize (>= 0.1)
36
+ ruby-debug-base (~> 0.10.4.0)
37
+ ruby-debug-base (0.10.4)
38
+ linecache (>= 0.3)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ pollyanna!
45
+ rails (= 2.3.8)
46
+ rspec (= 1.3.1)
47
+ rspec-rails (= 1.3.3)
48
+ ruby-debug
@@ -1,59 +1,68 @@
1
- = Pollyanna - very simple search for your ActiveRecord models
2
-
3
- Pollyanna adds a very simple full text search to your ActiveRecord models.
4
- Before saving, searchable models copy strings relevant to the search into a text column.
5
- Pollyanna finds results for a query using LIKE patterns in SQL.
6
-
7
- We found Pollyanna very useful for search-as-you-type boxes.
8
-
9
- == Example
10
-
11
- class Movie < ActiveRecord::Base
12
- include Pollyanna::Searchable
13
-
14
- def search_text
15
- "#{title} #{year} #{director}"
16
- end
17
-
18
- end
19
-
20
- class MoviesController
21
-
22
- def index
23
- @movies = Movie.search(params[:query])
24
- end
25
-
26
- end
27
-
28
- == Making a model searchable
29
-
30
- 1. Add a text column "search_text" to a model
31
- 2. Have the model include <tt>Pollyanna::Searchable</tt>
32
- 3. Overwrite <tt>search_text</tt> to define which text is indexed upon saving
33
- 4. <tt>Model.search("query goes here")</tt> now gives you a scope for the results of your query. Blank queries return everything.
34
-
35
- == Searching other columns
36
-
37
- If you want to search a column other than <tt>search_text</tt>, you may say <tt>Movie.search(query, :by => "other_column")</tt>.
38
-
39
- == How queries are matched
40
-
41
- - Pollyanna matches partial words, so "oo" matches "foo".
42
- - Multiple words in a query are AND-ed automatically.
43
-
44
- == Installation
45
-
46
- Add the following to your <tt>Initializer.run</tt> block in your <tt>environment.rb</tt>:
47
- config.gem 'pollyanna', :source => 'http://gemcutter.org'
48
- Then do a
49
- sudo rake gems:install
50
-
51
- Alternatively, use
52
- sudo gem sources -a http://gemcutter.org
53
- sudo gem install pollyanna
54
-
55
- == Credits
56
-
57
- Henning Koch
58
-
59
- {www.makandra.de}[http://www.makandra.de/]
1
+ = Pollyanna - very simple search for your ActiveRecord models
2
+
3
+ Pollyanna adds a very simple full text search to your ActiveRecord models.
4
+ Before saving, searchable models copy strings relevant to the search into a text column.
5
+ Pollyanna finds results for a query using LIKE patterns in SQL.
6
+
7
+ We found Pollyanna very useful for search-as-you-type boxes.
8
+
9
+ == Example
10
+
11
+ class Movie < ActiveRecord::Base
12
+ include Pollyanna::Searchable
13
+
14
+ def search_text
15
+ "#{title} #{year} #{director}"
16
+ end
17
+
18
+ end
19
+
20
+ class MoviesController
21
+
22
+ def index
23
+ @movies = Movie.search(params[:query])
24
+ end
25
+
26
+ end
27
+
28
+ == Making a model searchable
29
+
30
+ 1. Add a text column "search_text" to a model
31
+ 2. Have the model include <tt>Pollyanna::Searchable</tt>
32
+ 3. Overwrite <tt>search_text</tt> to define which text is indexed upon saving
33
+ 4. <tt>Model.search("query goes here")</tt> now gives you a scope for the results of your query. Blank queries return everything.
34
+
35
+ == Searching other columns
36
+
37
+ If you want to search a column other than <tt>search_text</tt>, you may say <tt>Movie.search(query, :by => "other_column")</tt>.
38
+
39
+ == How queries are matched
40
+
41
+ - Pollyanna matches partial words, so "oo" matches "foo".
42
+ - Multiple words in a query are AND-ed automatically.
43
+
44
+
45
+ == Installation
46
+
47
+ Pollyanna is a gem, which you can install with
48
+ sudo gem install pollyanna
49
+
50
+ In Rails 2, add the following to your <tt>environment.rb</tt>:
51
+ config.gem 'pollyanna'
52
+
53
+ In Rails 3, add the following to your <tt>Gemfile</tt>:
54
+ gem 'pollyanna'
55
+
56
+
57
+ == Rails 3 compatibility
58
+
59
+ We cannot guarantee Rails 3 compatibility at this point, but we will upgrade the gem when Rails 3 is released.
60
+
61
+
62
+ == Credits
63
+
64
+ Henning Koch
65
+
66
+ {makandra.com}[http://makandra.com/]
67
+
68
+ {gem-session.com}[http://gem-session.com/]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -4,8 +4,7 @@ module Pollyanna
4
4
  def self.included(klass)
5
5
  klass.class_eval do
6
6
  before_save :set_search_text
7
- # Use Proc.new so the number of arguments does not matter
8
- named_scope :search, Proc.new { |query, options| Search.new(query, table_name).scope_options(options) }
7
+ named_scope :search, lambda { |*args| query, options = args; Search.new(query, table_name).scope_options(options) }
9
8
  end
10
9
  end
11
10
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pollyanna}
8
- s.version = "1.0.3"
8
+ s.version = "1.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Henning Koch"]
12
- s.date = %q{2010-02-13}
12
+ s.date = %q{2011-03-14}
13
13
  s.description = %q{Very simple search for your ActiveRecord models.}
14
14
  s.email = %q{github@makandra.de}
15
15
  s.extra_rdoc_files = [
@@ -17,6 +17,8 @@ Gem::Specification.new do |s|
17
17
  ]
18
18
  s.files = [
19
19
  ".gitignore",
20
+ "Gemfile",
21
+ "Gemfile.lock",
20
22
  "MIT-LICENSE",
21
23
  "README.rdoc",
22
24
  "Rakefile",
@@ -49,22 +51,22 @@ Gem::Specification.new do |s|
49
51
  s.homepage = %q{http://github.com/makandra/pollyanna}
50
52
  s.rdoc_options = ["--charset=UTF-8"]
51
53
  s.require_paths = ["lib"]
52
- s.rubygems_version = %q{1.3.5}
54
+ s.rubygems_version = %q{1.3.7}
53
55
  s.summary = %q{Very simple search for your ActiveRecord models.}
54
56
  s.test_files = [
55
- "spec/search_spec.rb",
57
+ "spec/app_root/app/controllers/application_controller.rb",
56
58
  "spec/app_root/app/models/movie.rb",
57
- "spec/app_root/app/controllers/application_controller.rb",
59
+ "spec/app_root/config/boot.rb",
58
60
  "spec/app_root/config/environment.rb",
61
+ "spec/app_root/config/environments/in_memory.rb",
59
62
  "spec/app_root/config/environments/mysql.rb",
60
63
  "spec/app_root/config/environments/postgresql.rb",
61
- "spec/app_root/config/environments/sqlite3.rb",
62
- "spec/app_root/config/environments/in_memory.rb",
63
64
  "spec/app_root/config/environments/sqlite.rb",
64
- "spec/app_root/config/boot.rb",
65
+ "spec/app_root/config/environments/sqlite3.rb",
65
66
  "spec/app_root/config/routes.rb",
66
67
  "spec/app_root/db/migrate/001_create_movies.rb",
67
68
  "spec/app_root/lib/console_with_fixtures.rb",
69
+ "spec/search_spec.rb",
68
70
  "spec/searchable_spec.rb",
69
71
  "spec/spec_helper.rb"
70
72
  ]
@@ -73,7 +75,7 @@ Gem::Specification.new do |s|
73
75
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
74
76
  s.specification_version = 3
75
77
 
76
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
78
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
77
79
  else
78
80
  end
79
81
  else
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pollyanna
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 4
10
+ version: 1.0.4
5
11
  platform: ruby
6
12
  authors:
7
13
  - Henning Koch
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-13 00:00:00 +01:00
18
+ date: 2011-03-14 00:00:00 +01:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -23,6 +29,8 @@ extra_rdoc_files:
23
29
  - README.rdoc
24
30
  files:
25
31
  - .gitignore
32
+ - Gemfile
33
+ - Gemfile.lock
26
34
  - MIT-LICENSE
27
35
  - README.rdoc
28
36
  - Rakefile
@@ -61,37 +69,43 @@ rdoc_options:
61
69
  require_paths:
62
70
  - lib
63
71
  required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
64
73
  requirements:
65
74
  - - ">="
66
75
  - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
67
79
  version: "0"
68
- version:
69
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
70
82
  requirements:
71
83
  - - ">="
72
84
  - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
73
88
  version: "0"
74
- version:
75
89
  requirements: []
76
90
 
77
91
  rubyforge_project:
78
- rubygems_version: 1.3.5
92
+ rubygems_version: 1.3.7
79
93
  signing_key:
80
94
  specification_version: 3
81
95
  summary: Very simple search for your ActiveRecord models.
82
96
  test_files:
83
- - spec/search_spec.rb
84
- - spec/app_root/app/models/movie.rb
85
97
  - spec/app_root/app/controllers/application_controller.rb
98
+ - spec/app_root/app/models/movie.rb
99
+ - spec/app_root/config/boot.rb
86
100
  - spec/app_root/config/environment.rb
101
+ - spec/app_root/config/environments/in_memory.rb
87
102
  - spec/app_root/config/environments/mysql.rb
88
103
  - spec/app_root/config/environments/postgresql.rb
89
- - spec/app_root/config/environments/sqlite3.rb
90
- - spec/app_root/config/environments/in_memory.rb
91
104
  - spec/app_root/config/environments/sqlite.rb
92
- - spec/app_root/config/boot.rb
105
+ - spec/app_root/config/environments/sqlite3.rb
93
106
  - spec/app_root/config/routes.rb
94
107
  - spec/app_root/db/migrate/001_create_movies.rb
95
108
  - spec/app_root/lib/console_with_fixtures.rb
109
+ - spec/search_spec.rb
96
110
  - spec/searchable_spec.rb
97
111
  - spec/spec_helper.rb