From 3a65c877141421d5f4ca9c67bd0320874fa62f86 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Mon, 27 Jun 2022 14:32:20 +0100 Subject: [PATCH] Handle number 'Is in' --- packages/frontend-core/src/utils/lucene.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/frontend-core/src/utils/lucene.js b/packages/frontend-core/src/utils/lucene.js index e4acf1160d..9fa5a72317 100644 --- a/packages/frontend-core/src/utils/lucene.js +++ b/packages/frontend-core/src/utils/lucene.js @@ -102,8 +102,12 @@ export const buildLuceneQuery = filter => { if (type === "datetime" && value) { value = new Date(value).toISOString() } - if (type === "number") { - value = parseFloat(value) + if (type === "number" && !Array.isArray(value)) { + if (operator === "oneOf") { + value = value.split(",").map(item => parseFloat(item)) + } else { + value = parseFloat(value) + } } if (type === "boolean") { value = `${value}`?.toLowerCase() === "true" @@ -137,6 +141,7 @@ export const buildLuceneQuery = filter => { query[operator][field] = value } } else { + console.log("VAL ", value) query[operator][field] = value } }