Skip to content

Commit

Permalink
Fix issue related to geospatial search (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Aug 18, 2023
1 parent 21c016a commit 369acdb
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions services/concepts.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export class ConceptService {
if (!_.intersection(Object.keys(query), ["uri", "notation", "voc", "near"]).length) {
return []
}
let criteria = []
const criteria = []
const mongoQuery = { $and: criteria }
const uris = query.uri ? query.uri.split("|") : []
const notations = query.notation ? query.notation.split("|") : []
if (uris.length || notations.length) {
Expand Down Expand Up @@ -111,19 +112,16 @@ export class ConceptService {
if (!distance) {
throw new MalformedRequestError(`Parameter \`distance\` (${query.distance}) is malformed. Please give a number in km (default: 1).`)
}
criteria.push({
location: {
$nearSphere: {
$geometry: {
type: "Point",
coordinates: [longitude, latitude],
},
$maxDistance: distance,
mongoQuery.location = {
$nearSphere: {
$geometry: {
type: "Point",
coordinates: [longitude, latitude],
},
$maxDistance: distance,
},
})
}
}
const mongoQuery = { $and: criteria }
if (query.download) {
return conceptFind(mongoQuery, null, null, false).cursor()
}
Expand Down

0 comments on commit 369acdb

Please sign in to comment.