Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrasingh committed Aug 3, 2024
1 parent 896be5b commit 58a34db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions geoprox-core/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use patricia_tree::StringPatriciaMap;
use rayon::prelude::*;
use std::hash::{BuildHasher, BuildHasherDefault};

fn search_space(
fn build_search_space(
prefix_tree: &StringPatriciaMap<HashSet<ResourceIdentifier>>,
subregion_hash: &str,
) -> KdTree<f64, 2> {
Expand Down Expand Up @@ -127,7 +127,7 @@ impl SpatialIndex {
&self,
position: LatLngCoord,
radius: &f64,
max_qty: usize,
count: usize,
initial_depth: Option<usize>,
) -> Result<Vec<Neighbor>, GeohashError> {
if self.position_map.is_empty() {
Expand All @@ -151,8 +151,8 @@ impl SpatialIndex {
};

// ? compute nearest neighbors
let neighbors: Vec<Neighbor> = search_space(&self.prefix_tree, &search_region)
.nearest_n_within::<HaversineDistance>(&position, *radius, max_qty, false)
let neighbors: Vec<Neighbor> = build_search_space(&self.prefix_tree, &search_region)
.nearest_n_within::<HaversineDistance>(&position, *radius, count, false)
.par_iter()
.map(|node| {
let (resource_key, _) = self
Expand Down
1 change: 1 addition & 0 deletions geoprox-server/src/dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ pub struct QueryRange {
/// Search radius in kilometers
#[schema(minimum = 0, maximum = 0xFFFF)]
pub range: u16,
/// maximum number of neighbors returned
#[schema(minimum = 0, maximum = 0xFFFF)]
pub count: usize,
}
Expand Down

0 comments on commit 58a34db

Please sign in to comment.