geomodel 0.0.2 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90db919642b9d8269c289645bf18195b8efeb665
4
- data.tar.gz: 1278b9035c58e080d225e81aebc38ac7cf1a4b22
3
+ metadata.gz: 568cca72a146050ca2778a4bb8e0f5717bdb14ba
4
+ data.tar.gz: 5442b3cd80c73256afebec260de8081f53871194
5
5
  SHA512:
6
- metadata.gz: 3f471cead361f81bfa870db73eb9ad372f177cf77e6dfb329be0b8fce036e3dc16020f650ae384a7a5a5c9ddeb845058016477512aa95cd368d87fb9b150c9e6
7
- data.tar.gz: 17bc0e26b4f43181c3cb22cf398714fb65457bab4ddc495ae4928aba532f095eef9d8b5e6f303252ec5907283bd89ab06885dd6c7c0ffc49739aa90500831862
6
+ metadata.gz: 846bb9fa6bc8d79950c48f01b5a73441de130e231a7737ebd7dc28d50257dc9ad7535669deea89f9a0a0f70cb697408d075f1c8dba9937143f598f0351ad40a1
7
+ data.tar.gz: 0f1dcaadb4eb6b74927fef71b2b079b5c2b705981bb6073436909778aee2102db777b675b7918429f1fa2f6e578693d62fdf423195f6686aa21bdefd8f320dd7
@@ -2,4 +2,7 @@
2
2
  * Initial release - Straight port from Python, Java and JS implementations
3
3
 
4
4
  ### 0.0.2 (January 5, 2014)
5
- * Upped the test coverage (which revealed some pretty blatant bugs)
5
+ * Upped the test coverage (which revealed some pretty blatant bugs)
6
+
7
+ ### 0.0.3 (January 6, 2014)
8
+ * Cleaned up more bugs in proximity search after testing with Cassandra demo app
@@ -74,7 +74,7 @@ module Geomodel
74
74
  (!x.empty? && !y.empty?) ? x[1] <=> y[1] : 0
75
75
  end
76
76
 
77
- dup_fn = lambda do |x|
77
+ dup_fn = lambda do |x|
78
78
  (x.nil? || x.empty?) ? nil : x[0].id
79
79
  end # assuming the the element responds to #id
80
80
 
@@ -84,24 +84,24 @@ module Geomodel
84
84
  while !cur_geocells.empty?
85
85
  closest_possible_next_result_dist = sorted_edge_distances[0]
86
86
 
87
- next if max_distance && closest_possible_next_result_dist > max_distance
87
+ break if max_distance && closest_possible_next_result_dist > max_distance
88
88
 
89
89
  cur_geocells_unique = cur_geocells - searched_cells.to_a
90
-
90
+
91
91
  # Run query on the next set of geocells.
92
92
  cur_resolution = cur_geocells[0].size
93
-
93
+
94
94
  # Update results and sort.
95
95
  new_results = query_runner.call(cur_geocells_unique)
96
-
96
+
97
97
  searched_cells.merge(cur_geocells)
98
-
98
+
99
99
  # Begin storing distance from the search result entity to the
100
100
  # search center along with the search result itself, in a tuple.
101
101
  new_results = new_results.map { |entity| [entity, Geomodel::Math.distance(center, entity.location)] }
102
102
  new_results.sort! { |x, y| (!x.empty? && !y.empty?) ? x[1] <=> y[1] : 0 }
103
103
  new_results = new_results[0...max_results]
104
-
104
+
105
105
  # Merge new_results into results or the other way around, depending on
106
106
  # which is larger.
107
107
  if results.size > new_results.size
@@ -112,7 +112,7 @@ module Geomodel
112
112
  end
113
113
 
114
114
  results = results[0...max_results]
115
-
115
+
116
116
  sorted_edges, sorted_edge_distances = Geomodel::Util.distance_sorted_edges(cur_geocells, center)
117
117
 
118
118
  if results.empty? || cur_geocells.size == 4
@@ -121,7 +121,7 @@ module Geomodel
121
121
  # geocells.
122
122
  cur_containing_geocell = cur_containing_geocell[0...-1]
123
123
  cur_geocells = cur_geocells.map { |cell| cell[0...-1] }
124
- break if !cur_geocells.empty? || !cur_geocells[0] # Done with search, we've searched everywhere.
124
+ break if cur_geocells.empty? || !cur_geocells[0] # Done with search, we've searched everywhere.
125
125
  elsif cur_geocells.size == 1
126
126
  # Get adjacent in one direction.
127
127
  # TODO(romannurik): Watch for +/- 90 degree latitude edge case geocells.
@@ -155,4 +155,4 @@ module Geomodel
155
155
  results[0...max_results].keep_if { |result| max_distance == 0 || result.last < max_distance }
156
156
  end
157
157
 
158
- end
158
+ end
@@ -1,3 +1,3 @@
1
1
  module Geomodel
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geomodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Sam-Bodden