redis-textsearch 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ = Changelog for Redis::TextSearch
2
+
3
+ == 0.2.0 (12 August 2010)
4
+
5
+ * Now dependent on redis-rb client 2.0.4 or later. Should still be backwards compatible with redis-server 1.x
6
+
7
+ * Internal changes to bring client up-to-speed with redis-rb client changes
8
+
9
+ == 0.1.x series
10
+
11
+ * Core functionality implemented
12
+
@@ -80,14 +80,14 @@ class Redis
80
80
  pk = "#{table_name}.#{primary_key}"
81
81
  case options[:conditions]
82
82
  when Array
83
- if options[:conditions][1].is_a?(Hash)
83
+ if options[:conditions][1].is_a?(::Hash)
84
84
  options[:conditions][0] = "(#{options[:conditions][0]}) AND #{pk} IN (:text_search_ids)"
85
85
  options[:conditions][1][:text_search_ids] = ids
86
86
  else
87
87
  options[:conditions][0] = "(#{options[:conditions][0]}) AND #{pk} IN (?)"
88
88
  options[:conditions] << ids
89
89
  end
90
- when Hash
90
+ when ::Hash
91
91
  if options[:conditions].has_key?(primary_key.to_sym)
92
92
  raise BadConditions, "Cannot specify primary key (#{pk}) in :conditions to #{self.name}.text_search"
93
93
  end
@@ -102,7 +102,7 @@ class Redis
102
102
  # Define fields to be indexed for text search. To update the index, you must call
103
103
  # update_text_indexes after record save or at the appropriate point.
104
104
  def text_index(*args)
105
- options = args.last.is_a?(Hash) ? args.pop : {}
105
+ options = args.last.is_a?(::Hash) ? args.pop : {}
106
106
  options[:minlength] ||= 2
107
107
  options[:split] ||= /\s+/
108
108
  raise ArgumentError, "Must specify fields to index to #{self.name}.text_index" unless args.length > 0
@@ -118,7 +118,7 @@ class Redis
118
118
  # :page
119
119
  # :per_page
120
120
  def text_search(*args)
121
- options = args.length > 1 && args.last.is_a?(Hash) ? args.pop : {}
121
+ options = args.length > 1 && args.last.is_a?(::Hash) ? args.pop : {}
122
122
  fields = Array(options.delete(:fields) || @text_indexes.keys)
123
123
  finder = options.delete(:finder)
124
124
  unless finder
@@ -136,18 +136,18 @@ class Redis
136
136
  ids = []
137
137
  if args.empty?
138
138
  raise ArgumentError, "Must specify search string(s) to #{self.name}.text_search"
139
- elsif args.first.is_a?(Hash)
139
+ elsif args.first.is_a?(::Hash)
140
140
  sets = []
141
141
  args.first.each do |f,v|
142
142
  sets += text_search_sets_for(f,v)
143
143
  end
144
144
  # Execute single intersection (AND)
145
- ids = redis.set_intersect(*sets)
145
+ ids = redis.sinter(*sets)
146
146
  else
147
147
  fields.each do |f|
148
148
  sets = text_search_sets_for(f,args)
149
149
  # Execute intersection per loop (OR)
150
- ids += redis.set_intersect(*sets)
150
+ ids += redis.sinter(*sets)
151
151
  end
152
152
  end
153
153
 
@@ -186,17 +186,24 @@ class Redis
186
186
  def delete_text_indexes(id, *fields)
187
187
  fields = @text_indexes.keys if fields.empty?
188
188
  fields.each do |field|
189
- redis.pipelined do |pipe|
190
- text_indexes_for(id, field).each do |key|
191
- pipe.srem(key, id)
189
+ indexes = text_indexes_for(id, field)
190
+ redis.pipelined do
191
+ indexes.each do |key|
192
+ redis.srem(key, id)
192
193
  end
193
- pipe.del field_key("#{field}_indexes", id)
194
+ # blow away the entire reverse index, because we deleted the object
195
+ redis.del reverse_index_key(id, field)
194
196
  end
195
197
  end
196
198
  end
197
199
 
200
+ def reverse_index_key(id, field)
201
+ field_key("#{field}_indexes", id)
202
+ end
203
+
198
204
  def text_indexes_for(id, field) #:nodoc:
199
- (redis.get(field_key("#{field}_indexes", id)) || '').split(';')
205
+ v = redis.get reverse_index_key(id, field)
206
+ (v.nil? || v == '') ? [] : v.split(';')
200
207
  end
201
208
 
202
209
  def text_search_sets_for(field, values)
@@ -225,6 +232,11 @@ class Redis
225
232
  def text_indexes_for(field)
226
233
  self.class.text_indexes_for(id, field)
227
234
  end
235
+
236
+ # Name of the reverse index key
237
+ def reverse_index_key(field)
238
+ self.class.reverse_index_key(id, field)
239
+ end
228
240
 
229
241
  # Retrieve all text indexes
230
242
  def text_indexes
@@ -292,7 +304,7 @@ class Redis
292
304
  exec_pipelined_index_cmd(:srem, del_indexes)
293
305
 
294
306
  # Replace our reverse map of indexes
295
- redis.set field_key("#{field}_indexes"), indexes.join(';')
307
+ redis.set reverse_index_key(field), indexes.join(';')
296
308
  end # fields.each
297
309
  end
298
310
 
@@ -311,9 +323,9 @@ class Redis
311
323
 
312
324
  def exec_pipelined_index_cmd(cmd, indexes)
313
325
  return if indexes.empty?
314
- redis.pipelined do |pipe|
326
+ redis.pipelined do
315
327
  indexes.each do |key|
316
- pipe.send(cmd, key, id)
328
+ redis.send(cmd, key, id)
317
329
  end
318
330
  end
319
331
  end
@@ -105,40 +105,40 @@ describe Redis::TextSearch do
105
105
  @post.update_text_indexes
106
106
  @post2.update_text_indexes
107
107
 
108
- Post.redis.set_members('post:text_index:title:so').should == ['1']
109
- Post.redis.set_members('post:text_index:title:som').should == ['1']
110
- Post.redis.set_members('post:text_index:title:some').should == ['1']
111
- Post.redis.set_members('post:text_index:title:pl').sort.should == ['1','2']
112
- Post.redis.set_members('post:text_index:title:pla').sort.should == ['1','2']
113
- Post.redis.set_members('post:text_index:title:plai').sort.should == ['1','2']
114
- Post.redis.set_members('post:text_index:title:plain').sort.should == ['1','2']
115
- Post.redis.set_members('post:text_index:title:te').sort.should == ['1','2']
116
- Post.redis.set_members('post:text_index:title:tex').sort.should == ['1','2']
117
- Post.redis.set_members('post:text_index:title:text').sort.should == ['1','2']
118
- Post.redis.set_members('post:text_index:title:texts').should == ['2']
119
- Post.redis.set_members('post:text_index:title:textst').should == ['2']
120
- Post.redis.set_members('post:text_index:title:textstr').should == ['2']
121
- Post.redis.set_members('post:text_index:title:textstri').should == ['2']
122
- Post.redis.set_members('post:text_index:title:textstrin').should == ['2']
123
- Post.redis.set_members('post:text_index:title:textstring').should == ['2']
124
- Post.redis.set_members('post:text_index:tags:pe').should == []
125
- Post.redis.set_members('post:text_index:tags:per').should == []
126
- Post.redis.set_members('post:text_index:tags:pers').should == []
127
- Post.redis.set_members('post:text_index:tags:perso').should == []
128
- Post.redis.set_members('post:text_index:tags:person').should == []
129
- Post.redis.set_members('post:text_index:tags:persona').should == []
130
- Post.redis.set_members('post:text_index:tags:personal').should == ['1']
131
- Post.redis.set_members('post:text_index:tags:no').should == []
132
- Post.redis.set_members('post:text_index:tags:non').should == []
133
- Post.redis.set_members('post:text_index:tags:nont').should == []
134
- Post.redis.set_members('post:text_index:tags:nonte').should == []
135
- Post.redis.set_members('post:text_index:tags:nontec').should == []
136
- Post.redis.set_members('post:text_index:tags:nontech').should == []
137
- Post.redis.set_members('post:text_index:tags:nontechn').should == []
138
- Post.redis.set_members('post:text_index:tags:nontechni').should == []
139
- Post.redis.set_members('post:text_index:tags:nontechnic').should == []
140
- Post.redis.set_members('post:text_index:tags:nontechnica').should == []
141
- Post.redis.set_members('post:text_index:tags:nontechnical').should == ['1']
108
+ Post.redis.smembers('post:text_index:title:so').should == ['1']
109
+ Post.redis.smembers('post:text_index:title:som').should == ['1']
110
+ Post.redis.smembers('post:text_index:title:some').should == ['1']
111
+ Post.redis.smembers('post:text_index:title:pl').sort.should == ['1','2']
112
+ Post.redis.smembers('post:text_index:title:pla').sort.should == ['1','2']
113
+ Post.redis.smembers('post:text_index:title:plai').sort.should == ['1','2']
114
+ Post.redis.smembers('post:text_index:title:plain').sort.should == ['1','2']
115
+ Post.redis.smembers('post:text_index:title:te').sort.should == ['1','2']
116
+ Post.redis.smembers('post:text_index:title:tex').sort.should == ['1','2']
117
+ Post.redis.smembers('post:text_index:title:text').sort.should == ['1','2']
118
+ Post.redis.smembers('post:text_index:title:texts').should == ['2']
119
+ Post.redis.smembers('post:text_index:title:textst').should == ['2']
120
+ Post.redis.smembers('post:text_index:title:textstr').should == ['2']
121
+ Post.redis.smembers('post:text_index:title:textstri').should == ['2']
122
+ Post.redis.smembers('post:text_index:title:textstrin').should == ['2']
123
+ Post.redis.smembers('post:text_index:title:textstring').should == ['2']
124
+ Post.redis.smembers('post:text_index:tags:pe').should == []
125
+ Post.redis.smembers('post:text_index:tags:per').should == []
126
+ Post.redis.smembers('post:text_index:tags:pers').should == []
127
+ Post.redis.smembers('post:text_index:tags:perso').should == []
128
+ Post.redis.smembers('post:text_index:tags:person').should == []
129
+ Post.redis.smembers('post:text_index:tags:persona').should == []
130
+ Post.redis.smembers('post:text_index:tags:personal').should == ['1']
131
+ Post.redis.smembers('post:text_index:tags:no').should == []
132
+ Post.redis.smembers('post:text_index:tags:non').should == []
133
+ Post.redis.smembers('post:text_index:tags:nont').should == []
134
+ Post.redis.smembers('post:text_index:tags:nonte').should == []
135
+ Post.redis.smembers('post:text_index:tags:nontec').should == []
136
+ Post.redis.smembers('post:text_index:tags:nontech').should == []
137
+ Post.redis.smembers('post:text_index:tags:nontechn').should == []
138
+ Post.redis.smembers('post:text_index:tags:nontechni').should == []
139
+ Post.redis.smembers('post:text_index:tags:nontechnic').should == []
140
+ Post.redis.smembers('post:text_index:tags:nontechnica').should == []
141
+ Post.redis.smembers('post:text_index:tags:nontechnical').should == ['1']
142
142
  end
143
143
 
144
144
  it "should search text indexes and return records" do
@@ -44,7 +44,7 @@ TAGS = [
44
44
  ]
45
45
 
46
46
  describe Redis::TextSearch do
47
- before :all do
47
+ it "should define text indexes in the class" do
48
48
  @post = Post.new(:title => TITLES[0], :tags => TAGS[0] * ' ', :id => 1, :description => nil)
49
49
  @post2 = Post.new(:title => TITLES[1], :tags => TAGS[1], :id => 2, :description => nil)
50
50
  @post3 = Post.new(:title => TITLES[2], :tags => TAGS[2] * ' ', :id => 3, :description => nil)
@@ -52,9 +52,7 @@ describe Redis::TextSearch do
52
52
  @post.delete_text_indexes
53
53
  @post2.delete_text_indexes
54
54
  Post.delete_text_indexes(3)
55
- end
56
55
 
57
- it "should define text indexes in the class" do
58
56
  Post.text_indexes[:title][:key].should == 'post:text_index:title'
59
57
  Post.text_indexes[:tags][:key].should == 'post:text_index:tags'
60
58
  end
@@ -63,44 +61,44 @@ describe Redis::TextSearch do
63
61
  @post.update_text_indexes
64
62
  @post2.update_text_indexes
65
63
 
66
- Post.redis.set_members('post:text_index:title:s').should == []
67
- Post.redis.set_members('post:text_index:title:so').should == ['1']
68
- Post.redis.set_members('post:text_index:title:som').should == ['1']
69
- Post.redis.set_members('post:text_index:title:some').should == ['1']
70
- Post.redis.set_members('post:text_index:title:pl').sort.should == ['1','2']
71
- Post.redis.set_members('post:text_index:title:pla').sort.should == ['1','2']
72
- Post.redis.set_members('post:text_index:title:plai').sort.should == ['1','2']
73
- Post.redis.set_members('post:text_index:title:plain').sort.should == ['1','2']
74
- Post.redis.set_members('post:text_index:title:t').should == []
75
- Post.redis.set_members('post:text_index:title:te').sort.should == ['1','2']
76
- Post.redis.set_members('post:text_index:title:tex').sort.should == ['1','2']
77
- Post.redis.set_members('post:text_index:title:text').sort.should == ['1','2']
78
- Post.redis.set_members('post:text_index:title:texts').should == ['2']
79
- Post.redis.set_members('post:text_index:title:textst').should == ['2']
80
- Post.redis.set_members('post:text_index:title:textstr').should == ['2']
81
- Post.redis.set_members('post:text_index:title:textstri').should == ['2']
82
- Post.redis.set_members('post:text_index:title:textstrin').should == ['2']
83
- Post.redis.set_members('post:text_index:title:textstring').should == ['2']
84
- Post.redis.set_members('post:text_index:tags:p').should == []
85
- Post.redis.set_members('post:text_index:tags:pe').should == []
86
- Post.redis.set_members('post:text_index:tags:per').should == []
87
- Post.redis.set_members('post:text_index:tags:pers').should == []
88
- Post.redis.set_members('post:text_index:tags:perso').should == []
89
- Post.redis.set_members('post:text_index:tags:person').should == []
90
- Post.redis.set_members('post:text_index:tags:persona').should == []
91
- Post.redis.set_members('post:text_index:tags:personal').should == ['1']
92
- Post.redis.set_members('post:text_index:tags:n').should == []
93
- Post.redis.set_members('post:text_index:tags:no').should == []
94
- Post.redis.set_members('post:text_index:tags:non').should == []
95
- Post.redis.set_members('post:text_index:tags:nont').should == []
96
- Post.redis.set_members('post:text_index:tags:nonte').should == []
97
- Post.redis.set_members('post:text_index:tags:nontec').should == []
98
- Post.redis.set_members('post:text_index:tags:nontech').should == []
99
- Post.redis.set_members('post:text_index:tags:nontechn').should == []
100
- Post.redis.set_members('post:text_index:tags:nontechni').should == []
101
- Post.redis.set_members('post:text_index:tags:nontechnic').should == []
102
- Post.redis.set_members('post:text_index:tags:nontechnica').should == []
103
- Post.redis.set_members('post:text_index:tags:nontechnical').should == ['1']
64
+ Post.redis.smembers('post:text_index:title:s').should == []
65
+ Post.redis.smembers('post:text_index:title:so').should == ['1']
66
+ Post.redis.smembers('post:text_index:title:som').should == ['1']
67
+ Post.redis.smembers('post:text_index:title:some').should == ['1']
68
+ Post.redis.smembers('post:text_index:title:pl').sort.should == ['1','2']
69
+ Post.redis.smembers('post:text_index:title:pla').sort.should == ['1','2']
70
+ Post.redis.smembers('post:text_index:title:plai').sort.should == ['1','2']
71
+ Post.redis.smembers('post:text_index:title:plain').sort.should == ['1','2']
72
+ Post.redis.smembers('post:text_index:title:t').should == []
73
+ Post.redis.smembers('post:text_index:title:te').sort.should == ['1','2']
74
+ Post.redis.smembers('post:text_index:title:tex').sort.should == ['1','2']
75
+ Post.redis.smembers('post:text_index:title:text').sort.should == ['1','2']
76
+ Post.redis.smembers('post:text_index:title:texts').should == ['2']
77
+ Post.redis.smembers('post:text_index:title:textst').should == ['2']
78
+ Post.redis.smembers('post:text_index:title:textstr').should == ['2']
79
+ Post.redis.smembers('post:text_index:title:textstri').should == ['2']
80
+ Post.redis.smembers('post:text_index:title:textstrin').should == ['2']
81
+ Post.redis.smembers('post:text_index:title:textstring').should == ['2']
82
+ Post.redis.smembers('post:text_index:tags:p').should == []
83
+ Post.redis.smembers('post:text_index:tags:pe').should == []
84
+ Post.redis.smembers('post:text_index:tags:per').should == []
85
+ Post.redis.smembers('post:text_index:tags:pers').should == []
86
+ Post.redis.smembers('post:text_index:tags:perso').should == []
87
+ Post.redis.smembers('post:text_index:tags:person').should == []
88
+ Post.redis.smembers('post:text_index:tags:persona').should == []
89
+ Post.redis.smembers('post:text_index:tags:personal').should == ['1']
90
+ Post.redis.smembers('post:text_index:tags:n').should == []
91
+ Post.redis.smembers('post:text_index:tags:no').should == []
92
+ Post.redis.smembers('post:text_index:tags:non').should == []
93
+ Post.redis.smembers('post:text_index:tags:nont').should == []
94
+ Post.redis.smembers('post:text_index:tags:nonte').should == []
95
+ Post.redis.smembers('post:text_index:tags:nontec').should == []
96
+ Post.redis.smembers('post:text_index:tags:nontech').should == []
97
+ Post.redis.smembers('post:text_index:tags:nontechn').should == []
98
+ Post.redis.smembers('post:text_index:tags:nontechni').should == []
99
+ Post.redis.smembers('post:text_index:tags:nontechnic').should == []
100
+ Post.redis.smembers('post:text_index:tags:nontechnica').should == []
101
+ Post.redis.smembers('post:text_index:tags:nontechnical').should == ['1']
104
102
  end
105
103
 
106
104
  it "should search text indexes and return records" do
@@ -156,20 +154,20 @@ describe Redis::TextSearch do
156
154
  Post.text_search(:description => 'flame').should == ['4']
157
155
  Post.text_search(:description => 'flame dude').should == [] # NOT SUPPORTED (must left-anchor)
158
156
 
159
- Post.redis.set_members('post:text_index:description:red.flame.dude').should == ['4']
160
- Post.redis.set_members('post:text_index:description:red.flame.dud').should == ['4']
161
- Post.redis.set_members('post:text_index:description:red.flame.du').should == ['4']
162
- Post.redis.set_members('post:text_index:description:red.flame.d').should == ['4']
163
- Post.redis.set_members('post:text_index:description:red.flame.').should == ['4']
164
- Post.redis.set_members('post:text_index:description:red.flame').should == ['4']
165
- Post.redis.set_members('post:text_index:description:red.flam').should == ['4']
166
- Post.redis.set_members('post:text_index:description:red.fla').should == ['4']
167
- Post.redis.set_members('post:text_index:description:red.fl').should == ['4']
168
- Post.redis.set_members('post:text_index:description:red.f').should == ['4']
169
- Post.redis.set_members('post:text_index:description:red.').should == ['4']
170
- Post.redis.set_members('post:text_index:description:red').should == ['4']
171
- Post.redis.set_members('post:text_index:description:re').should == ['4']
172
- Post.redis.set_members('post:text_index:description:r').should == []
157
+ Post.redis.smembers('post:text_index:description:red.flame.dude').should == ['4']
158
+ Post.redis.smembers('post:text_index:description:red.flame.dud').should == ['4']
159
+ Post.redis.smembers('post:text_index:description:red.flame.du').should == ['4']
160
+ Post.redis.smembers('post:text_index:description:red.flame.d').should == ['4']
161
+ Post.redis.smembers('post:text_index:description:red.flame.').should == ['4']
162
+ Post.redis.smembers('post:text_index:description:red.flame').should == ['4']
163
+ Post.redis.smembers('post:text_index:description:red.flam').should == ['4']
164
+ Post.redis.smembers('post:text_index:description:red.fla').should == ['4']
165
+ Post.redis.smembers('post:text_index:description:red.fl').should == ['4']
166
+ Post.redis.smembers('post:text_index:description:red.f').should == ['4']
167
+ Post.redis.smembers('post:text_index:description:red.').should == ['4']
168
+ Post.redis.smembers('post:text_index:description:red').should == ['4']
169
+ Post.redis.smembers('post:text_index:description:re').should == ['4']
170
+ Post.redis.smembers('post:text_index:description:r').should == []
173
171
  end
174
172
 
175
173
  # MUST BE LAST!!!!!!
@@ -105,40 +105,40 @@ describe Redis::TextSearch do
105
105
  @post.update_text_indexes
106
106
  @post2.update_text_indexes
107
107
 
108
- Post.redis.set_members('post:text_index:title:so').should == ['1']
109
- Post.redis.set_members('post:text_index:title:som').should == ['1']
110
- Post.redis.set_members('post:text_index:title:some').should == ['1']
111
- Post.redis.set_members('post:text_index:title:pl').sort.should == ['1','2']
112
- Post.redis.set_members('post:text_index:title:pla').sort.should == ['1','2']
113
- Post.redis.set_members('post:text_index:title:plai').sort.should == ['1','2']
114
- Post.redis.set_members('post:text_index:title:plain').sort.should == ['1','2']
115
- Post.redis.set_members('post:text_index:title:te').sort.should == ['1','2']
116
- Post.redis.set_members('post:text_index:title:tex').sort.should == ['1','2']
117
- Post.redis.set_members('post:text_index:title:text').sort.should == ['1','2']
118
- Post.redis.set_members('post:text_index:title:texts').should == ['2']
119
- Post.redis.set_members('post:text_index:title:textst').should == ['2']
120
- Post.redis.set_members('post:text_index:title:textstr').should == ['2']
121
- Post.redis.set_members('post:text_index:title:textstri').should == ['2']
122
- Post.redis.set_members('post:text_index:title:textstrin').should == ['2']
123
- Post.redis.set_members('post:text_index:title:textstring').should == ['2']
124
- Post.redis.set_members('post:text_index:tags:pe').should == []
125
- Post.redis.set_members('post:text_index:tags:per').should == []
126
- Post.redis.set_members('post:text_index:tags:pers').should == []
127
- Post.redis.set_members('post:text_index:tags:perso').should == []
128
- Post.redis.set_members('post:text_index:tags:person').should == []
129
- Post.redis.set_members('post:text_index:tags:persona').should == []
130
- Post.redis.set_members('post:text_index:tags:personal').should == ['1']
131
- Post.redis.set_members('post:text_index:tags:no').should == []
132
- Post.redis.set_members('post:text_index:tags:non').should == []
133
- Post.redis.set_members('post:text_index:tags:nont').should == []
134
- Post.redis.set_members('post:text_index:tags:nonte').should == []
135
- Post.redis.set_members('post:text_index:tags:nontec').should == []
136
- Post.redis.set_members('post:text_index:tags:nontech').should == []
137
- Post.redis.set_members('post:text_index:tags:nontechn').should == []
138
- Post.redis.set_members('post:text_index:tags:nontechni').should == []
139
- Post.redis.set_members('post:text_index:tags:nontechnic').should == []
140
- Post.redis.set_members('post:text_index:tags:nontechnica').should == []
141
- Post.redis.set_members('post:text_index:tags:nontechnical').should == ['1']
108
+ Post.redis.smembers('post:text_index:title:so').should == ['1']
109
+ Post.redis.smembers('post:text_index:title:som').should == ['1']
110
+ Post.redis.smembers('post:text_index:title:some').should == ['1']
111
+ Post.redis.smembers('post:text_index:title:pl').sort.should == ['1','2']
112
+ Post.redis.smembers('post:text_index:title:pla').sort.should == ['1','2']
113
+ Post.redis.smembers('post:text_index:title:plai').sort.should == ['1','2']
114
+ Post.redis.smembers('post:text_index:title:plain').sort.should == ['1','2']
115
+ Post.redis.smembers('post:text_index:title:te').sort.should == ['1','2']
116
+ Post.redis.smembers('post:text_index:title:tex').sort.should == ['1','2']
117
+ Post.redis.smembers('post:text_index:title:text').sort.should == ['1','2']
118
+ Post.redis.smembers('post:text_index:title:texts').should == ['2']
119
+ Post.redis.smembers('post:text_index:title:textst').should == ['2']
120
+ Post.redis.smembers('post:text_index:title:textstr').should == ['2']
121
+ Post.redis.smembers('post:text_index:title:textstri').should == ['2']
122
+ Post.redis.smembers('post:text_index:title:textstrin').should == ['2']
123
+ Post.redis.smembers('post:text_index:title:textstring').should == ['2']
124
+ Post.redis.smembers('post:text_index:tags:pe').should == []
125
+ Post.redis.smembers('post:text_index:tags:per').should == []
126
+ Post.redis.smembers('post:text_index:tags:pers').should == []
127
+ Post.redis.smembers('post:text_index:tags:perso').should == []
128
+ Post.redis.smembers('post:text_index:tags:person').should == []
129
+ Post.redis.smembers('post:text_index:tags:persona').should == []
130
+ Post.redis.smembers('post:text_index:tags:personal').should == ['1']
131
+ Post.redis.smembers('post:text_index:tags:no').should == []
132
+ Post.redis.smembers('post:text_index:tags:non').should == []
133
+ Post.redis.smembers('post:text_index:tags:nont').should == []
134
+ Post.redis.smembers('post:text_index:tags:nonte').should == []
135
+ Post.redis.smembers('post:text_index:tags:nontec').should == []
136
+ Post.redis.smembers('post:text_index:tags:nontech').should == []
137
+ Post.redis.smembers('post:text_index:tags:nontechn').should == []
138
+ Post.redis.smembers('post:text_index:tags:nontechni').should == []
139
+ Post.redis.smembers('post:text_index:tags:nontechnic').should == []
140
+ Post.redis.smembers('post:text_index:tags:nontechnica').should == []
141
+ Post.redis.smembers('post:text_index:tags:nontechnical').should == ['1']
142
142
  end
143
143
 
144
144
  it "should search text indexes and return records" do
@@ -1,4 +1,8 @@
1
+ require 'bacon'
2
+ Bacon.summary_on_exit
3
+
1
4
  $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
5
+ gem 'redis', '>= 2.0.4'
2
6
  require 'redis'
3
7
  require 'redis/text_search'
4
8
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 4
9
- version: 0.1.4
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nate Wiger
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-17 00:00:00 -07:00
17
+ date: 2010-08-12 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -25,9 +25,10 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  segments:
28
+ - 2
28
29
  - 0
29
- - 1
30
- version: "0.1"
30
+ - 4
31
+ version: 2.0.4
31
32
  type: :runtime
32
33
  version_requirements: *id001
33
34
  description: Crazy fast text search using Redis. Works with any ORM or data store.
@@ -37,6 +38,7 @@ executables: []
37
38
  extensions: []
38
39
 
39
40
  extra_rdoc_files:
41
+ - CHANGELOG.rdoc
40
42
  - README.rdoc
41
43
  files:
42
44
  - lib/redis/text_search/collection.rb
@@ -45,6 +47,7 @@ files:
45
47
  - spec/redis_text_search_core_spec.rb
46
48
  - spec/redis_text_search_sequel_spec.rb
47
49
  - spec/spec_helper.rb
50
+ - CHANGELOG.rdoc
48
51
  - README.rdoc
49
52
  has_rdoc: true
50
53
  homepage: http://github.com/nateware/redis-textsearch
@@ -71,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
74
  - 0
72
75
  version: "0"
73
76
  requirements:
74
- - redis, v0.1 or greater
77
+ - redis, v2.0.4 or greater
75
78
  rubyforge_project: redis-textsearch
76
79
  rubygems_version: 1.3.6
77
80
  signing_key: