diff --git a/entity/AroundLocation_entity/entityfields/contactids/valueProcess.js b/entity/AroundLocation_entity/entityfields/contactids/valueProcess.js index 8c557caa9b6b62169cea92902fa269f0c678bbc9..c501306c787ed2ea99fafce699b725c12c5d94bf 100644 --- a/entity/AroundLocation_entity/entityfields/contactids/valueProcess.js +++ b/entity/AroundLocation_entity/entityfields/contactids/valueProcess.js @@ -5,12 +5,14 @@ import("system.indexsearch"); import("system.neon"); var contactIds = []; +var hitCount = 0; +var totalHitCount = 0; var radius = vars.get("$field.SearchRadius"); var lat = vars.get("$param.LocationLat_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 var excludedUid = vars.get("$param.OriginUid_param"); @@ -50,8 +52,10 @@ if (radius && lat && lon) contactIds = indexResult.HITS.map(function (e){ return e[indexsearch.FIELD_ID]; }); - neon.setFieldValue("$field.HitCount", contactIds.length); - neon.setFieldValue("$field.TotalHitCount", indexResult.TOTALHITS); + hitCount = contactIds.length; + totalHitCount = indexResult.TOTALHITS; } +neon.setFieldValue("$field.HitCount", hitCount); +neon.setFieldValue("$field.TotalHitCount", totalHitCount); result.string(JSON.stringify(contactIds)); \ No newline at end of file