pg_search 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = PgSearch
2
2
 
3
+ == 0.5.7
4
+
5
+ * Fix issue with eager loading now that the Scope class has been removed. (Piotr Murach)
6
+
3
7
  == 0.5.6
4
8
 
5
9
  * PgSearch#multisearchable accepts :if and :unless for conditional inclusion
data/README.rdoc CHANGED
@@ -87,6 +87,36 @@ You can also pass a Proc or method name to call to determine whether or not a pa
87
87
  :if => lambda { |record| record.model_year > 1970 }
88
88
  end
89
89
 
90
+ Note that the Proc or method name is called in an after_save hook. This means that you should be careful when using Time or other objects. In the following example, if the record was last saved before the published_at timestamp, it won't get listed in global search at all until it is touched again after the timestamp.
91
+
92
+ class AntipatternExample
93
+ include PgSearch
94
+ multisearchable :against => [:contents],
95
+ :if => :published?
96
+
97
+ def published?
98
+ published_at < Time.now
99
+ end
100
+ end
101
+
102
+ problematic_record = AntipatternExample.create!(
103
+ :contents => "Using :if with a timestamp",
104
+ :published_at => 10.minutes.from_now
105
+ )
106
+
107
+ problematic_record.published? # => false
108
+ PgSearch.multisearch("timestamp") # => No results
109
+
110
+ sleep 20.minutes
111
+
112
+ problematic_record.published? # => true
113
+ PgSearch.multisearch("timestamp") # => No results
114
+
115
+ problematic_record.save!
116
+
117
+ problematic_record.published? # => true
118
+ PgSearch.multisearch("timestamp") # => Includes problematic_record
119
+
90
120
  ==== Multi-search associations
91
121
 
92
122
  Two associations are built automatically. On the original record, there is a has_one :pg_search_document association pointing to the PgSearch::Document record, and on the PgSearch::Document record there is a belongs_to :searchable polymorphic association pointing back to the original record.
data/lib/pg_search.rb CHANGED
@@ -9,7 +9,6 @@ module PgSearch
9
9
  autoload :Multisearch, "pg_search/multisearch"
10
10
  autoload :Multisearchable, "pg_search/multisearchable"
11
11
  autoload :Normalizer, "pg_search/normalizer"
12
- autoload :Scope, "pg_search/scope"
13
12
  autoload :ScopeOptions, "pg_search/scope_options"
14
13
  autoload :VERSION, "pg_search/version"
15
14
 
@@ -1,3 +1,3 @@
1
1
  module PgSearch
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
metadata CHANGED
@@ -1,60 +1,56 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pg_search
3
- version: !ruby/object:Gem::Version
4
- hash: 7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.7
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 6
10
- version: 0.5.6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Case Commons, LLC
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-29 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- hash: 5
27
- segments:
28
- - 3
29
- version: "3"
30
- prerelease: false
31
- type: :runtime
12
+ date: 2012-10-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
32
15
  name: activerecord
33
- requirement: *id001
34
- - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
36
17
  none: false
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- hash: 5
41
- segments:
42
- - 3
43
- version: "3"
44
- prerelease: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '3'
45
22
  type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3'
30
+ - !ruby/object:Gem::Dependency
46
31
  name: activesupport
47
- requirement: *id002
48
- description: PgSearch builds ActiveRecord named scopes that take advantage of PostgreSQL's full text search
49
- email:
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '3'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '3'
46
+ description: PgSearch builds ActiveRecord named scopes that take advantage of PostgreSQL's
47
+ full text search
48
+ email:
50
49
  - casecommons-dev@googlegroups.com
51
50
  executables: []
52
-
53
51
  extensions: []
54
-
55
52
  extra_rdoc_files: []
56
-
57
- files:
53
+ files:
58
54
  - .autotest
59
55
  - .gitignore
60
56
  - .rspec
@@ -107,38 +103,36 @@ files:
107
103
  - sql/unnest.sql
108
104
  homepage: https://github.com/Casecommons/pg_search
109
105
  licenses: []
110
-
111
106
  post_install_message:
112
107
  rdoc_options: []
113
-
114
- require_paths:
108
+ require_paths:
115
109
  - lib
116
- required_ruby_version: !ruby/object:Gem::Requirement
110
+ required_ruby_version: !ruby/object:Gem::Requirement
117
111
  none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- hash: 3
122
- segments:
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ segments:
123
117
  - 0
124
- version: "0"
125
- required_rubygems_version: !ruby/object:Gem::Requirement
118
+ hash: -1475822108196160881
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
120
  none: false
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- hash: 3
131
- segments:
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ segments:
132
126
  - 0
133
- version: "0"
127
+ hash: -1475822108196160881
134
128
  requirements: []
135
-
136
129
  rubyforge_project:
137
130
  rubygems_version: 1.8.24
138
131
  signing_key:
139
132
  specification_version: 3
140
- summary: PgSearch builds ActiveRecord named scopes that take advantage of PostgreSQL's full text search
141
- test_files:
133
+ summary: PgSearch builds ActiveRecord named scopes that take advantage of PostgreSQL's
134
+ full text search
135
+ test_files:
142
136
  - spec/associations_spec.rb
143
137
  - spec/pg_search/document_spec.rb
144
138
  - spec/pg_search/multisearch/rebuilder_spec.rb