mongoid-fts 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/mongoid-fts.rb +27 -6
- data/mongoid-fts.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjNhZWNkYjRiMmYzYWY1MmU4YmI3M2Y5ZDdmMGQ0MThmNWMzMDY5Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjY4ODFlNmNjNzVjMjg3ODliOGI1NjcyOTVmZWEyMGVmNGM0OTlhMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MWNlYTA1Zjg3NjM4ZTQxNTcxNjZmZWVkZjdkMGI5ZDRkNDM4MmY0ZDRmMmI5
|
10
|
+
NzhiMDQ4OGU2NjZlODkxNGU2YjgwOTQ1YzM0ZWQxZDU1ZDljM2VhOTZjYjQx
|
11
|
+
ZmYxNWNlYjlmODc2ODkzOGU3M2ZlNzQyOTgxYTJjMzcyYmU5Mzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Mjg5YTI3ZTY0NTNiNjgwODE5MTE0YTBlZWQwM2YxY2NhNWMwMTIwNmRkOTRh
|
14
|
+
YTI1MWM3OTVkNGVkMWQwOGQ0OWQ3YmYxODdkYzI0NmUzZmMwODQ5OTA4OWFi
|
15
|
+
ODNlODIwM2YzYjA2ZGYyODc0YzczN2I2OTA0NWY1NDU1MjZjNDE=
|
data/lib/mongoid-fts.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Mongoid
|
2
2
|
module FTS
|
3
3
|
#
|
4
|
-
const_set(:Version, '0.4.
|
4
|
+
const_set(:Version, '0.4.4') unless const_defined?(:Version)
|
5
5
|
|
6
6
|
class << FTS
|
7
7
|
def version
|
@@ -55,6 +55,8 @@ module Mongoid
|
|
55
55
|
nil
|
56
56
|
end
|
57
57
|
|
58
|
+
#
|
59
|
+
class Error < ::StandardError; end
|
58
60
|
|
59
61
|
#
|
60
62
|
def FTS.search(*args)
|
@@ -361,13 +363,30 @@ module Mongoid
|
|
361
363
|
:fulltext => fulltext
|
362
364
|
}
|
363
365
|
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
366
|
+
begin
|
367
|
+
new(conditions).upsert
|
368
|
+
rescue Object => e
|
369
|
+
warn "#{ e.message } (#{ e.class })"
|
370
|
+
|
371
|
+
4.times do
|
372
|
+
begin
|
373
|
+
break if create(conditions)
|
374
|
+
rescue Object => e
|
375
|
+
warn "#{ e.message } (#{ e.class })"
|
376
|
+
nil
|
377
|
+
end
|
369
378
|
end
|
370
379
|
end
|
380
|
+
|
381
|
+
# FIXME - go BOOM here if none found...
|
382
|
+
#
|
383
|
+
index = where(conditions).first
|
384
|
+
|
385
|
+
if index
|
386
|
+
index.update_attributes(attributes)
|
387
|
+
else
|
388
|
+
raise Error.new("failed to create index for #{ conditions.inspect }")
|
389
|
+
end
|
371
390
|
end
|
372
391
|
|
373
392
|
def Index.remove(model)
|
@@ -451,6 +470,8 @@ module Mongoid
|
|
451
470
|
after_destroy do |model|
|
452
471
|
FTS::Index.remove(model) rescue nil
|
453
472
|
end
|
473
|
+
|
474
|
+
has_one(:search_index, :as => :context, :class_name => '::Mongoid::FTS::Index')
|
454
475
|
end
|
455
476
|
end
|
456
477
|
|
data/mongoid-fts.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "mongoid-fts"
|
6
|
-
spec.version = "0.4.
|
6
|
+
spec.version = "0.4.4"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "mongoid-fts"
|
9
9
|
spec.description = "enable mongodb's new fulltext simply and quickly on your mongoid models, including pagination."
|