rad_core_rails 0.9.0 → 0.9.3
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 +4 -4
- data/Gemfile +1 -0
- data/lib/rad_core_rails/query_generator.rb +5 -11
- data/lib/rad_core_rails/version.rb +1 -1
- data/lib/rad_core_rails/zip_code.rb +17 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d0dc43295dda40c1ac95be85803c9a2272eb31eca835df51e823862a58b3fb9
|
4
|
+
data.tar.gz: c8b0ce17d1612acb98a714f9b0caee76f5b9f81bd4cae018991b0dd2a7a69f70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6935eb8ed311670806c281cb93a2382c35f419b4cc65a6b4d7c78efa358ca78b3ba10de058c2074e62caa60d3568669c0655d1458e4d51210decda550ac67622
|
7
|
+
data.tar.gz: 38e156a6136accc13554513063b07453e9d24f83863b0ccde0a468c1740473f20560362bf05b5d761e86a7b6ea7c6416118c35b32c3d349821c4ed23a49ea7ec
|
data/Gemfile
CHANGED
@@ -281,8 +281,8 @@ module RadCoreRails
|
|
281
281
|
|
282
282
|
vector_string = sanitize_vector_string(filter[:values][0], weight)
|
283
283
|
|
284
|
-
query = "(#{column_name} @@ to_tsquery('simple', ?))"
|
285
|
-
[query, [vector_string]]
|
284
|
+
query = "(#{column_name} @@ to_tsquery('simple', ?) OR #{column_name} @@ to_tsquery('english', ?))"
|
285
|
+
[query, [vector_string, vector_string]]
|
286
286
|
end
|
287
287
|
|
288
288
|
def generate_zip_codes_clause(column_name, filter)
|
@@ -357,19 +357,13 @@ module RadCoreRails
|
|
357
357
|
args = []
|
358
358
|
|
359
359
|
case option
|
360
|
-
when '='
|
361
|
-
str = "#{column_name}::date = ?::date"
|
362
|
-
args << values[0]
|
363
|
-
when '>'
|
364
|
-
str = "#{column_name}::date > ?::date"
|
365
|
-
args << values[0]
|
366
|
-
when '<'
|
367
|
-
str = "#{column_name}::date < ?::date"
|
368
|
-
args << values[0]
|
369
360
|
when '..'
|
370
361
|
str = "(#{column_name}::date BETWEEN ?::date AND ?::date)"
|
371
362
|
args << values[0]
|
372
363
|
args << values[1]
|
364
|
+
else
|
365
|
+
str = "#{column_name}::date #{option} ?::date"
|
366
|
+
args << values[0]
|
373
367
|
end
|
374
368
|
[str, args]
|
375
369
|
end
|
@@ -28,17 +28,23 @@ module RadCoreRails
|
|
28
28
|
# Query for returning an array of zip codes around the zip-code sent to this function with a given radius in miles.
|
29
29
|
def distance_query
|
30
30
|
<<-SQL
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
31
|
+
WITH t AS (SELECT
|
32
|
+
zip, (
|
33
|
+
3959 * ACOS (
|
34
|
+
LEAST(
|
35
|
+
GREATEST(
|
36
|
+
(
|
37
|
+
COS(RADIANS((#{lat_sub_query})))
|
38
|
+
* COS(RADIANS(zip_codes.latitude))
|
39
|
+
* COS(RADIANS(zip_codes.longitude) - RADIANS((#{lng_sub_query})))
|
40
|
+
+ SIN(RADIANS((#{lat_sub_query})))
|
41
|
+
* SIN(RADIANS(zip_codes.latitude))
|
42
|
+
), -1
|
43
|
+
), 1
|
44
|
+
)
|
45
|
+
)
|
46
|
+
) AS distance
|
47
|
+
FROM zip_codes) SELECT t.zip FROM t WHERE t.distance < ?
|
42
48
|
SQL
|
43
49
|
end
|
44
50
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rad_core_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleksandr Poltavets, James Marrs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|