cowtech-rails 2.7.0.0 → 2.7.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -122,21 +122,25 @@ module Cowtech
|
|
122
122
|
expr = self.mongo_parse_search(search_query)
|
123
123
|
|
124
124
|
# Build the query
|
125
|
+
or_query = []
|
125
126
|
(args[:fields] || []).each do |field|
|
126
|
-
|
127
|
+
or_query << {field.to_sym => Regexp.new(expr, Regexp::EXTENDED | Regexp::MULTILINE | Regexp::IGNORECASE)}
|
127
128
|
end
|
128
129
|
|
129
130
|
# Now add external fields
|
130
131
|
# TODO: Can we enhance this?
|
131
132
|
(args[:external] || []).each do |external|
|
132
133
|
external_query = external[:class].not_deleted
|
134
|
+
eor_query = []
|
133
135
|
(external[:fields] || []).each do |field|
|
134
|
-
|
136
|
+
eor_query << {field.to_sym => Regexp.new(expr, Regexp::EXTENDED | Regexp::MULTILINE | Regexp::IGNORECASE)}
|
135
137
|
end
|
136
138
|
|
137
|
-
ids = external_query.only(:id).all.collect {|r| r.id }
|
138
|
-
|
139
|
+
ids = external_query.any_of(eor_query).only(:id).all.collect {|r| r.id }
|
140
|
+
or_query << {external[:foreign_key].in => ids} if ids.count > 0
|
139
141
|
end
|
142
|
+
|
143
|
+
@mongo_query = @mongo_query.any_of(or_query)
|
140
144
|
end
|
141
145
|
|
142
146
|
@mongo_query
|
data/lib/cowtech/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cowtech-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-07 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cowtech-extensions
|
16
|
-
requirement: &
|
16
|
+
requirement: &70220120113560 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70220120113560
|
25
25
|
description: A general purpose Rails utility plugin.
|
26
26
|
email: shogun_panda@me.com
|
27
27
|
executables: []
|