textacular 4.0.1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 496462806ce43763aaeefe0d72e47bf1ed300a4d
4
- data.tar.gz: 1ce89e8864290e04eccbf312aac17b65dac96211
3
+ metadata.gz: d18e4abd3e1261c47932907d778c6733c930cdff
4
+ data.tar.gz: bf77d7e537625947e8b610dfd5177079418fff5c
5
5
  SHA512:
6
- metadata.gz: aec40e799a52f138444950693b6606446c50d011fb17fabb3d96218c2831693498ba89584f474c0539a2dd48b3eb45596f9c443362812696fd85419069889138
7
- data.tar.gz: d3f7dffb02381e1364474c1df66c0a464d9927794c354569de0905e434d58e5e449d012c5bd656c3c74fc2e034a99e87ddb40f7a3e11f5d3ec24224bd668935f
6
+ metadata.gz: 43dc9f5012e6c8bb1da0811e55e48d0795a7fa8eff3a0127ec29c08b02c8fafca339f2e9ecb397abfd77baed9267893ed6efd53809a217903752c3fec1368fd8
7
+ data.tar.gz: 28b8cdc8eb8f7c00f12d5827c47aad0204f5e509abab74699618a9feff177a9e8d6b7c6dad053bddde0d6e8c6c03c3ef9fa223824cbd543ddd2746cab2a3a95f
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.0.0
6
+
7
+ * ActiveRecord 5.1 compatibility
8
+ * drop support for ActiveRecord older than 5.0 and Ruby version lower than 2.2.5
9
+
5
10
  ## 4.0.1
6
11
 
7
12
  * ActiveRecord 5 compatibility above 5.0.0
data/README.md CHANGED
@@ -25,12 +25,20 @@ extending ActiveRecord with scopes making search easy and fun!
25
25
 
26
26
  ### Quick Start
27
27
 
28
- #### Rails 3, Rails 4 and Rails 5!
28
+ #### Rails 3, Rails 4
29
29
 
30
30
  In the project's Gemfile add
31
31
 
32
32
  ```ruby
33
- gem 'textacular', '~> 3.0'
33
+ gem 'textacular', '~> 4.0'
34
+ ```
35
+
36
+ #### Rails 5.0 and Rails 5.1!
37
+
38
+ In the project's Gemfile add
39
+
40
+ ```ruby
41
+ gem 'textacular', '~> 5.0'
34
42
  ```
35
43
 
36
44
  #### ActiveRecord outside of Rails
@@ -140,12 +148,20 @@ end
140
148
  You can have Postgresql use an index for the full-text search. To declare a full-text index, in a
141
149
  migration add code like the following:
142
150
 
151
+ #### For basic_search
143
152
  ```ruby
144
153
  execute "
145
154
  create index on email_logs using gin(to_tsvector('english', subject));
146
155
  create index on email_logs using gin(to_tsvector('english', email_address));"
147
156
  ```
148
157
 
158
+ #### For fuzzy_search
159
+ ```ruby
160
+ execute "
161
+ CREATE INDEX trgm_subject_indx ON users USING gist (subject gist_trgm_ops);
162
+ CREATE INDEX trgm_email_address_indx ON users USING gist (email_address gist_trgm_ops);
163
+ ```
164
+
149
165
  In the above example, the table email_logs has two text columns that we search against, subject and email_address.
150
166
  You will need to add an index for every text/string column you query against, or else Postgresql will revert to a
151
167
  full table scan instead of using the indexes.
@@ -16,7 +16,7 @@ class #{model_name}FullTextSearch < ActiveRecord::Migration
16
16
  end
17
17
  MIGRATION
18
18
  filename = "#{model_name.underscore}_full_text_search"
19
- generator = Textacular::MigrationGenerator.new(content, filename)
19
+ generator = Textacular::MigrationGenerator.new(filename, content)
20
20
  generator.generate_migration
21
21
  end
22
22
 
@@ -52,7 +52,7 @@ MIGRATION
52
52
  <<-SQL
53
53
  CREATE index #{index_name_for(model, column)}
54
54
  ON #{model.table_name}
55
- USING gin(to_tsvector("#{dictionary}", "#{model.table_name}"."#{column}"::text));
55
+ USING gin(to_tsvector('#{dictionary}', "#{model.table_name}"."#{column}"::text));
56
56
  SQL
57
57
  end
58
58
 
@@ -1,5 +1,5 @@
1
1
  module Textacular
2
- VERSION = '4.0.1'
2
+ VERSION = '5.0.0'
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -12,7 +12,7 @@ class WebComicWithSearchableNameFullTextSearch < ActiveRecord::Migration
12
12
  DROP index IF EXISTS web_comics_name_fts_idx;
13
13
  CREATE index web_comics_name_fts_idx
14
14
  ON web_comics
15
- USING gin(to_tsvector("english", "web_comics"."name"::text));
15
+ USING gin(to_tsvector('english', "web_comics"."name"::text));
16
16
  SQL
17
17
  end
18
18
 
@@ -25,7 +25,7 @@ end
25
25
  MIGRATION
26
26
 
27
27
  generator = double(:migration_generator)
28
- expect(Textacular::MigrationGenerator).to receive(:new).with(content, file_name).and_return(generator)
28
+ expect(Textacular::MigrationGenerator).to receive(:new).with(file_name, content).and_return(generator)
29
29
  expect(generator).to receive(:generate_migration)
30
30
 
31
31
  Textacular::FullTextIndexer.new.generate_migration('WebComicWithSearchableName')
@@ -42,11 +42,11 @@ class WebComicWithSearchableNameAndAuthorFullTextSearch < ActiveRecord::Migratio
42
42
  DROP index IF EXISTS web_comics_name_fts_idx;
43
43
  CREATE index web_comics_name_fts_idx
44
44
  ON web_comics
45
- USING gin(to_tsvector("english", "web_comics"."name"::text));
45
+ USING gin(to_tsvector('english', "web_comics"."name"::text));
46
46
  DROP index IF EXISTS web_comics_author_fts_idx;
47
47
  CREATE index web_comics_author_fts_idx
48
48
  ON web_comics
49
- USING gin(to_tsvector("english", "web_comics"."author"::text));
49
+ USING gin(to_tsvector('english', "web_comics"."author"::text));
50
50
  SQL
51
51
  end
52
52
 
@@ -60,7 +60,7 @@ end
60
60
  MIGRATION
61
61
 
62
62
  generator = double(:migration_generator)
63
- expect(Textacular::MigrationGenerator).to receive(:new).with(content, file_name).and_return(generator)
63
+ expect(Textacular::MigrationGenerator).to receive(:new).with(file_name, content).and_return(generator)
64
64
  expect(generator).to receive(:generate_migration)
65
65
 
66
66
  Textacular::FullTextIndexer.new.generate_migration('WebComicWithSearchableNameAndAuthor')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textacular
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Hamill
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-10-18 00:00:00.000000000 Z
14
+ date: 2017-06-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pg
@@ -104,7 +104,7 @@ dependencies:
104
104
  - - ">="
105
105
  - !ruby/object:Gem::Version
106
106
  version: '3.0'
107
- - - "<"
107
+ - - "<="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '5.1'
110
110
  type: :runtime
@@ -114,7 +114,7 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '3.0'
117
- - - "<"
117
+ - - "<="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '5.1'
120
120
  description: |-
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  requirements: []
183
183
  rubyforge_project:
184
- rubygems_version: 2.2.2
184
+ rubygems_version: 2.4.5
185
185
  signing_key:
186
186
  specification_version: 4
187
187
  summary: Textacular exposes full text search capabilities from PostgreSQL