From c67691efe1f2b9d711a58bb337a544989239640a Mon Sep 17 00:00:00 2001 From: Yossi Eynav Date: Wed, 14 Feb 2024 01:54:54 +0200 Subject: [PATCH] hotfix(PlanController): fix the filtering --- server/api/controller/plan.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/api/controller/plan.js b/server/api/controller/plan.js index 7ffd72749..d7f53c4a8 100644 --- a/server/api/controller/plan.js +++ b/server/api/controller/plan.js @@ -68,13 +68,13 @@ class PlanController extends Controller { q.orderByRaw = ['distance']; delete q.order; - if (Config.locationSearch.filterPlansRadiusKm !== null) { - // use ST_Within to filter for plans with centroids within a polygon - // created with ST_Buffer. this makes use of the index on geom_centroid - q.whereRaw = [ - Knex.raw(`ST_Within(geom_centroid, ST_Buffer(ST_GeomFromText("${polygon}", 4326), ${Config.locationSearch.filterPlansRadiusKm}*1000/${spatialUnitFactor}))`) - ]; - } + console.log("Config.locationSearch", Config.locationSearch) + + // use ST_Within to filter for plans with centroids within a polygon + // created with ST_Buffer. this makes use of the index on geom_centroid + q.whereRaw = [ + Knex.raw(`ST_Within(geom_centroid, ST_Buffer(ST_GeomFromText("${polygon}", 4326), ${Config.locationSearch.filterPlansRadiusKm || 10}*1000/${spatialUnitFactor}))`) + ]; // filter out plans that should not be returned in geo search q.where.geo_search_filter = [false];