Skip to content

Commit

Permalink
bugfix: ensure that autocomplete can't be selected w/ group search
Browse files Browse the repository at this point in the history
  • Loading branch information
densumesh authored and skeptrunedev committed Jan 9, 2025
1 parent 0d61996 commit bdb54e7
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions frontends/search/src/components/SearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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",
Expand Down

0 comments on commit bdb54e7

Please sign in to comment.