From 0ccfaf03afc50e607b168145abf0ccfba2b7edc7 Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:06:19 +0100 Subject: [PATCH] Fixing problems when switching between match any and match all (#11179) * Make sure displayed filter count is correct * Fix for false boolean filter --- packages/backend-core/src/db/lucene.ts | 3 +++ .../design/settings/controls/FilterEditor/FilterEditor.svelte | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/backend-core/src/db/lucene.ts b/packages/backend-core/src/db/lucene.ts index d501bb2166..a491451a62 100644 --- a/packages/backend-core/src/db/lucene.ts +++ b/packages/backend-core/src/db/lucene.ts @@ -433,6 +433,9 @@ export class QueryBuilder { if (!value) { return null } + if (typeof value === "boolean") { + return `(*:* AND !${key}:${value})` + } return `!${key}:${builder.preprocess(value, allPreProcessingOpts)}` }) } diff --git a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte index 9d48789947..88c3842f54 100644 --- a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte +++ b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterEditor.svelte @@ -20,7 +20,7 @@ $: datasource = getDatasourceForProvider($currentAsset, componentInstance) $: schema = getSchemaForDatasource($currentAsset, datasource)?.schema $: schemaFields = Object.values(schema || {}) - $: text = getText(value) + $: text = getText(value?.filter(filter => filter.field)) async function saveFilter() { dispatch("change", tempValue)