Skip to content

Commit

Permalink
fix(search): only limit to bbox if no search string or tags were given
Browse files Browse the repository at this point in the history
  • Loading branch information
flosse committed Jan 19, 2018
1 parent dc623c5 commit cd55da1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/business/usecase/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,13 @@ fn extend_bbox(bbox: &Bbox) -> Bbox {
}

pub fn search<D: Db>(db: &D, req: &SearchRequest) -> Result<(Vec<Entry>, Vec<Entry>)> {
let extended_bbox = extend_bbox(&req.bbox);
let mut entries = db.get_entries_by_bbox(&extended_bbox)?;

let mut entries = if req.text.is_empty() && req.tags.is_empty() {
let extended_bbox = extend_bbox(&req.bbox);
db.get_entries_by_bbox(&extended_bbox)?
} else {
db.all_entries()?
};

if let Some(ref cat_ids) = req.categories {
entries = entries
Expand Down

0 comments on commit cd55da1

Please sign in to comment.