Skip to content
Snippets Groups Projects
Commit af3c2a42 authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

AroundLocation fix: did not update when radius was removed

parent ce421513
No related branches found
No related tags found
No related merge requests found
...@@ -5,12 +5,14 @@ import("system.indexsearch"); ...@@ -5,12 +5,14 @@ import("system.indexsearch");
import("system.neon"); import("system.neon");
var contactIds = []; var contactIds = [];
var hitCount = 0;
var totalHitCount = 0;
var radius = vars.get("$field.SearchRadius"); var radius = vars.get("$field.SearchRadius");
var lat = vars.get("$param.LocationLat_param"); var lat = vars.get("$param.LocationLat_param");
var lon = vars.get("$param.LocationLon_param"); var lon = vars.get("$param.LocationLon_param");
if (radius && lat && lon) if (radius && lat && lon && !vars.get("$sys.validationerrors"))
{ {
//filter our origin uid because otherwise we would have the origin organisation in our resultset //filter our origin uid because otherwise we would have the origin organisation in our resultset
var excludedUid = vars.get("$param.OriginUid_param"); var excludedUid = vars.get("$param.OriginUid_param");
...@@ -50,8 +52,10 @@ if (radius && lat && lon) ...@@ -50,8 +52,10 @@ if (radius && lat && lon)
contactIds = indexResult.HITS.map(function (e){ contactIds = indexResult.HITS.map(function (e){
return e[indexsearch.FIELD_ID]; return e[indexsearch.FIELD_ID];
}); });
neon.setFieldValue("$field.HitCount", contactIds.length); hitCount = contactIds.length;
neon.setFieldValue("$field.TotalHitCount", indexResult.TOTALHITS); totalHitCount = indexResult.TOTALHITS;
} }
neon.setFieldValue("$field.HitCount", hitCount);
neon.setFieldValue("$field.TotalHitCount", totalHitCount);
result.string(JSON.stringify(contactIds)); result.string(JSON.stringify(contactIds));
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment