From bdb54e7e8ca02d62572e366aa11420f24fba9b87 Mon Sep 17 00:00:00 2001 From: Dens Sumesh Date: Thu, 9 Jan 2025 13:52:41 -0800 Subject: [PATCH] bugfix: ensure that autocomplete can't be selected w/ group search --- .../search/src/components/SearchForm.tsx | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/frontends/search/src/components/SearchForm.tsx b/frontends/search/src/components/SearchForm.tsx index daafe47c2d..8cb66d7724 100644 --- a/frontends/search/src/components/SearchForm.tsx +++ b/frontends/search/src/components/SearchForm.tsx @@ -85,16 +85,6 @@ const SearchForm = (props: { isSelected: false, route: "semantic", }, - { - name: "AutoComplete Semantic", - isSelected: false, - route: "autocomplete-semantic", - }, - { - name: "AutoComplete FullText", - isSelected: false, - route: "autocomplete-fulltext", - }, ]; if (bm25Active) { @@ -120,6 +110,36 @@ const SearchForm = (props: { }, ]); + createEffect(() => { + if (!props.search.state.groupUniqueSearch) { + console.log("groupUniqueSearch is false"); + + setSearchTypes((prev) => { + return prev.concat([ + { + name: "AutoComplete Semantic", + isSelected: false, + route: "autocomplete-semantic", + }, + { + name: "AutoComplete FullText", + isSelected: false, + route: "autocomplete-fulltext", + }, + ]); + }); + } else { + console.log("groupUniqueSearch is true"); + setSearchTypes((prev) => { + return prev.filter( + (type) => + type.route !== "autocomplete-semantic" && + type.route !== "autocomplete-fulltext", + ); + }); + } + }); + const defaultRerankTypes = [ { name: "Semantic",