texticle 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,162 +1,151 @@
1
- == 2.1.0
1
+ # Change Log
2
+
3
+ ## 2.1.1
4
+
5
+ * 1 bugfix
6
+ * Include `lib/texticle/version.rb` in the gemspec so the gem will load. Sorry!
2
7
 
3
- * 1 DEPRECATION
4
8
 
9
+ ## 2.1.0
10
+
11
+ * 1 DEPRECATION
5
12
  * `search` aliases new `advanced_search` method (same functionality as before), but will
6
13
  alias `basic_search` in 3.0! Should print warnings.
7
-
8
14
  * 3 new features
9
-
10
15
  * Generate full text search indexes from a rake task (sort of like in 1.x). Supply a specific
11
16
  model name.
12
17
  * New search methods: `basic_search`, `advanced_search` and `fuzzy_search`. Basic allows special
13
18
  characters like &, and % in search terms. Fuzzy is based on Postgres's trigram matching extension
14
19
  pg_trgm. Advanced is the same functionality from `search` previously.
15
20
  * Rake task that installs pg_trgm now works on Postgres 9.1 and up.
16
-
17
21
  * 2 dev improvements
18
-
19
22
  * Test database configuration not automatically generated from a rake task and ignored by git.
20
23
  * New interactive developer console (powered by pry).
21
24
 
22
- == 2.0.3
23
25
 
24
- * 1 new feature
26
+ ## 2.0.3
25
27
 
28
+ * 1 new feature
26
29
  * Allow searching through relations. Model.join(:relation).search(:relation => {:column => "query"})
27
30
  works, and reduces the need for multi-model tables. Huge thanks to Ben Hamill for the pull request.
28
31
  * Allow searching through all model columns irrespective of the column's type; we cast all columns to text
29
32
  in the search query. Performance may degrade when searching through anything but a string column.
30
-
31
33
  * 2 bugfixes
32
-
33
34
  * Fix exceptions when adding Texticle to a table-less model.
34
35
  * Column names in a search query are now scoped to the current table.
35
-
36
36
  * 1 dev improvement
37
-
38
37
  * Running `rake` from the project root will setup the test environment by creating a test database
39
38
  and running the necessary migrations. `rake` can also be used to run all the project tests.
40
39
 
41
- == 2.0.2
42
40
 
43
- * 1 bugfix
41
+ ## 2.0.2
44
42
 
43
+ * 1 bugfix
45
44
  * Our #respond_to? overwritten method was causing failures when a model didn't have
46
45
  a table (e.g. if migrations hadn't been run yet). Not the case anymore.
47
46
 
48
- == 2.0.1
49
47
 
50
- * 1 new feature
48
+ ## 2.0.1
51
49
 
50
+ * 1 new feature
52
51
  * Can now define #searchable_language to specify the language used for the query. This changes
53
52
  what's considered a stop word on Postgres' side. 'english' is the default language.
54
-
55
53
  * 1 bugfix
56
-
57
54
  * We were only specifying a language in to_tsvector() and not in to_tsquery(), which could
58
55
  cause queries to fail if the default database language wasn't set to 'english'.
59
56
 
60
- == 2.0.pre4
61
57
 
62
- * 1 new feature
58
+ ## 2.0.pre4
63
59
 
60
+ * 1 new feature
64
61
  * Searchable is now available to specify which columns you want searched:
65
62
 
63
+ ```ruby
66
64
  require 'texticle/searchable'
67
65
  class Game
68
66
  extend Searchable(:title)
69
67
  end
68
+ ```
70
69
 
71
- This also allows Texticle use in Rails without having #search available to all models:
70
+ This also allows Texticle use in Rails without having #search available to all models:
72
71
 
72
+ ```
73
73
  gem 'texticle', '~> 2.0.pre4', :require => 'texticle/searchable'
74
-
74
+ ```
75
75
  * 1 bugfix
76
-
77
76
  * ActiveRecord::Base.extend(Texticle) doesn't break #method_missing and #respond_to? anymore
78
77
 
79
78
 
80
- == 2.0.pre3
79
+ ## 2.0.pre3
81
80
 
82
81
  * 1 new feature
83
-
84
82
  * #select calls now limit the columns that are searched
85
-
86
83
  * 1 bugfix
87
-
88
84
  * #search calls without an argument assume an empty string as a search term (it errored out previously)
89
85
 
90
- == 2.0.pre2
91
86
 
92
- * 1 bugfix
87
+ ## 2.0.pre2
93
88
 
89
+ * 1 bugfix
94
90
  * #respond_to? wasn't overwritten correctly
95
91
 
96
- === 2.0.pre
92
+ ## 2.0.pre
97
93
 
98
94
  * Complete refactoring of Texticle
99
-
100
95
  * For users:
101
-
102
96
  * Texticle should only be used for its simplicity; if you need to deeply configure your text search, please give `gem install pg_search` a try.
103
- * #search method is now included in all ActiveRecord models by default, and searches across a model's :string columns.
104
- * #search_by_<column> dynamic methods are now available.
105
- * #search can now be chained; Game.search_by_title("Street Fighter").search_by_system("PS3") works.
106
- * #search now accepts a hash to specify columns to be searched, e.g. Game.search(:name => "Mario")
107
- * No more access to #rank values for results (though they're still ordered by rank).
97
+ * `#search` method is now included in all ActiveRecord models by default, and searches across a model's :string columns.
98
+ * `#search_by_<column>` dynamic methods are now available.
99
+ * `#search` can now be chained; `Game.search_by_title("Street Fighter").search_by_system("PS3")` works.
100
+ * `#search` now accepts a hash to specify columns to be searched, e.g. `Game.search(:name => "Mario")`
101
+ * No more access to `#rank` values for results (though they're still ordered by rank).
108
102
  * No way to give different weights to different columns in this release.
109
-
110
103
  * For devs:
111
-
112
104
  * We now have actual tests to run against; this will make accepting pull requests much more enjoyable.
113
105
 
114
- === HEAD (unreleased)
115
106
 
116
- * 1 minor bugfix
107
+ ## HEAD (unreleased)
117
108
 
109
+ * 1 minor bugfix
118
110
  * Multiple named indices are now supported.
119
111
 
120
- === 1.0.4 / 2010-08-19
121
112
 
122
- * 2 major enhancements
113
+ ## 1.0.4 / 2010-08-19
123
114
 
115
+ * 2 major enhancements
124
116
  * use Rails.root instead of RAILS_ROOT
125
117
  * refactored tasks to ease maintainance and patchability
126
-
127
118
  * 3 minor enhancements
128
-
129
119
  * fix timestamp for migrationfile
130
120
  * fixed deprecation warning for rails3 (dropping rails2-support)
131
121
  * prevented warning about defined constant
132
122
 
133
- === 1.0.3 / 2010-07-07
134
123
 
135
- * 1 major enhancement
124
+ ## 1.0.3 / 2010-07-07
136
125
 
126
+ * 1 major enhancement
137
127
  * Added Rails 3 support.
138
-
139
128
  * 1 bugfix
140
-
141
129
  * Model names that end in double 's's (like Address) don't choke the rake tasks anymore.
142
130
 
143
- === 1.0.2 / 2009-10-17
144
131
 
145
- * 1 bugfix
132
+ ## 1.0.2 / 2009-10-17
146
133
 
134
+ * 1 bugfix
147
135
  * Generated migration now uses UTC time rather than local time.
148
136
 
149
- === 1.0.1 / 2009-04-14
150
137
 
151
- * 1 minor enhancement
138
+ ## 1.0.1 / 2009-04-14
152
139
 
140
+ * 1 minor enhancement
153
141
  * Textical adds a rake task to generate FTS index migrations. Just run:
154
142
 
143
+ ```
155
144
  rake textical:migration
145
+ ```
156
146
 
157
- === 1.0.0 / 2009-04-14
158
147
 
159
- * 1 major enhancement
148
+ ## 1.0.0 / 2009-04-14
160
149
 
150
+ * 1 major enhancement
161
151
  * Birthday!
162
-
@@ -1,64 +1,97 @@
1
- = texticle
1
+ # texticle
2
2
 
3
- Further documentation available at:
3
+ Further documentation available at http://texticle.github.com/texticle.
4
4
 
5
- * http://tenderlove.github.com/texticle
6
5
 
7
- == DESCRIPTION:
6
+ ## DESCRIPTION:
8
7
 
9
8
  Texticle exposes full text search capabilities from PostgreSQL,
10
9
  extending ActiveRecord with scopes making search easy and fun!
11
10
 
12
- == FEATURES/PROBLEMS:
11
+
12
+ ## FEATURES/PROBLEMS:
13
13
 
14
14
  * Only works with PostgreSQL
15
15
 
16
- == SYNOPSIS:
17
16
 
18
- === Quick Start
17
+ ## SYNOPSIS:
18
+
19
+ ### Quick Start
19
20
 
20
- * Rails 3
21
+ #### Rails 3
21
22
 
22
23
  In the project's Gemfile add
23
24
 
24
- gem 'texticle', '~> 2.0', :require => 'texticle/rails'
25
+ gem 'texticle', '~> 2.0', require: 'texticle/rails'
26
+
27
+
28
+ #### ActiveRecord outside of Rails 3
29
+
30
+ ```ruby
31
+ require 'texticle'
32
+
33
+ ActiveRecord::Base.extend(Texticle)
34
+ ```
35
+
36
+
37
+ ### Usage
25
38
 
26
- * ActiveRecord outside of Rails 3
39
+ Your models now have access to search methods:
27
40
 
28
- require 'texticle'
29
- ActiveRecord::Base.extend(Texticle)
41
+ The `#basic_search` method is what you might expect: it looks literally for what
42
+ you send to it, doing nothing fancy with the input:
30
43
 
31
- === Usage
44
+ ```ruby
45
+ Game.basic_search('Sonic') # will search through the model's :string columns
46
+ Game.basic_search(title: 'Mario', system: 'Nintendo')
47
+ ```
32
48
 
33
- Your models now have access to the search method:
49
+ The `#advanced_search` method lets you use Postgres's search syntax like '|',
50
+ '&' and '!' ('or', 'and', and 'not') as well as some other craziness. Check [the
51
+ Postgres
52
+ docs](http://www.postgresql.org/docs/9.2/static/datatype-textsearch.html) for more:
34
53
 
35
- Game.search('Sonic') # will search through the model's :string columns
36
- Game.search(:title => 'Mario')
37
- Game.search_by_title('Street Fighter').search_by_system('PS3')
38
- Game.search_by_title_and_system('Final Fantasy', 'PS2')
39
- Game.search_by_title_or_system('Final Fantasy, 'PS3')
54
+ ```ruby
55
+ Game.advanced_search(title: 'Street|Fantasy')
56
+ Game.advanced_search(system: '!PS2')
57
+ ```
40
58
 
41
- You can use '|' and '&' for logical conditions.
59
+ Finally, the `#fuzzy_search` method lets you use Postgres's trigram search
60
+ funcionality:
42
61
 
43
- Game.search_by_title_or_system('Final Fantasy', 'PS3|Xbox')
62
+ ```ruby
63
+ Comic.fuzzy_search(title: 'Questio') # matches Questionable Content
64
+ ```
44
65
 
45
- === Setting Language
66
+ Searches are also chainable:
67
+
68
+ ```ruby
69
+ Game.fuzzy_search(title: 'tree').basic_search(system: 'SNES')
70
+ ```
71
+
72
+
73
+ ### Setting Language
46
74
 
47
75
  To set proper searching dictionary just override class method on your model:
48
76
 
49
- def self.searchable_language
50
- 'russian'
51
- end
77
+ ```ruby
78
+ def self.searchable_language
79
+ 'russian'
80
+ end
81
+ ```
52
82
 
53
83
  And all your queries would go right! And don`t forget to change the migration for indexes, like shown below.
54
84
 
55
- === Creating Indexes for Super Speed
85
+
86
+ ### Creating Indexes for Super Speed
56
87
  You can have Postgresql use an index for the full-text search. To declare a full-text index, in a
57
88
  migration add code like the following:
58
89
 
59
- execute "
60
- create index on email_logs using gin(to_tsvector('english', subject));
61
- create index on email_logs using gin(to_tsvector('english', email_address));"
90
+ ```ruby
91
+ execute "
92
+ create index on email_logs using gin(to_tsvector('english', subject));
93
+ create index on email_logs using gin(to_tsvector('english', email_address));"
94
+ ```
62
95
 
63
96
  In the above example, the table email_logs has two text columns that we search against, subject and email_address.
64
97
  You will need to add an index for every text/string column you query against, or else Postgresql will revert to a
@@ -66,18 +99,25 @@ full table scan instead of using the indexes.
66
99
 
67
100
  If you create these indexes, you should also switch to sql for your schema_format in `config/application.rb`:
68
101
 
69
- config.active_record.schema_format = :sql
102
+ ```ruby
103
+ config.active_record.schema_format = :sql
104
+ ```
70
105
 
71
- == REQUIREMENTS:
106
+
107
+ ## REQUIREMENTS:
72
108
 
73
109
  * ActiveRecord
74
110
  * Ruby 1.9.2
75
111
 
76
- == INSTALL:
77
112
 
78
- * gem install texticle
113
+ ## INSTALL:
114
+
115
+ ```
116
+ $ gem install texticle
117
+ ```
118
+
79
119
 
80
- == LICENSE:
120
+ ## LICENSE:
81
121
 
82
122
  (The MIT License)
83
123
 
@@ -0,0 +1,7 @@
1
+ module Texticle
2
+ VERSION = '2.1.1'
3
+
4
+ def self.version
5
+ VERSION
6
+ end
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texticle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -116,22 +116,20 @@ email:
116
116
  - ecin@copypastel.com
117
117
  executables: []
118
118
  extensions: []
119
- extra_rdoc_files:
120
- - Manifest.txt
121
- - CHANGELOG.rdoc
122
- - README.rdoc
119
+ extra_rdoc_files: []
123
120
  files:
124
- - CHANGELOG.rdoc
121
+ - CHANGELOG.md
125
122
  - Gemfile
126
123
  - Manifest.txt
127
- - README.rdoc
124
+ - README.md
128
125
  - Rakefile
129
126
  - lib/texticle.rb
130
127
  - lib/texticle/full_text_indexer.rb
128
+ - lib/texticle/postgres_module_installer.rb
131
129
  - lib/texticle/rails.rb
132
130
  - lib/texticle/searchable.rb
133
131
  - lib/texticle/tasks.rb
134
- - lib/texticle/postgres_module_installer.rb
132
+ - lib/texticle/version.rb
135
133
  - spec/config.yml.example
136
134
  - spec/fixtures/character.rb
137
135
  - spec/fixtures/game.rb
@@ -143,9 +141,7 @@ homepage: http://texticle.github.com/texticle
143
141
  licenses:
144
142
  - MIT
145
143
  post_install_message:
146
- rdoc_options:
147
- - --main
148
- - README.rdoc
144
+ rdoc_options: []
149
145
  require_paths:
150
146
  - lib
151
147
  required_ruby_version: !ruby/object:Gem::Requirement