From ff1eb6a78e97fc253ac7e92c2938f64e7dc49892 Mon Sep 17 00:00:00 2001 From: asier-isayas Date: Fri, 24 Oct 2025 12:15:12 -0700 Subject: [PATCH] Add French, German, and Spanish to Full Text Search (Update container only) (#2228) * Add multiple languages for Full Text Search Policy * fix tests * show multiple languages for multi language support enabled accounts * addressed comments --------- Co-authored-by: Asier Isayas --- src/Common/Constants.ts | 2 +- .../FullTextPoliciesComponent.tsx | 31 ++++++++++++++++--- .../AddCollectionPanel/AddCollectionPanel.tsx | 2 ++ .../AddCollectionPanel.test.tsx.snap | 1 + src/Utils/CapabilityUtils.ts | 7 +++++ 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index b3c15e423..01df9a9c2 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -89,7 +89,7 @@ export class CapabilityNames { public static readonly EnableMongo: string = "EnableMongo"; public static readonly EnableServerless: string = "EnableServerless"; public static readonly EnableNoSQLVectorSearch: string = "EnableNoSQLVectorSearch"; - public static readonly EnableNoSQLFullTextSearch: string = "EnableNoSQLFullTextSearch"; + public static readonly EnableNoSQLFullTextSearchPreviewFeatures: string = "EnableNoSQLFullTextSearchPreviewFeatures"; } export enum CapacityMode { diff --git a/src/Explorer/Controls/FullTextSeach/FullTextPoliciesComponent.tsx b/src/Explorer/Controls/FullTextSeach/FullTextPoliciesComponent.tsx index 8972791ce..a32a0dba0 100644 --- a/src/Explorer/Controls/FullTextSeach/FullTextPoliciesComponent.tsx +++ b/src/Explorer/Controls/FullTextSeach/FullTextPoliciesComponent.tsx @@ -12,6 +12,7 @@ import { import { FullTextIndex, FullTextPath, FullTextPolicy } from "Contracts/DataModels"; import { CollapsibleSectionComponent } from "Explorer/Controls/CollapsiblePanel/CollapsibleSectionComponent"; import * as React from "react"; +import { isFullTextSearchPreviewFeaturesEnabled } from "Utils/CapabilityUtils"; export interface FullTextPoliciesComponentProps { fullTextPolicy: FullTextPolicy; @@ -22,6 +23,7 @@ export interface FullTextPoliciesComponentProps { ) => void; discardChanges?: boolean; onChangesDiscarded?: () => void; + englishOnly?: boolean; } export interface FullTextPolicyData { @@ -66,6 +68,7 @@ export const FullTextPoliciesComponent: React.FunctionComponent { const getFullTextPathError = (path: string, index?: number): string => { let error = ""; @@ -87,6 +90,7 @@ export const FullTextPoliciesComponent: React.FunctionComponent ({ ...fullTextPath, pathError: getFullTextPathError(fullTextPath.path), @@ -166,7 +170,7 @@ export const FullTextPoliciesComponent: React.FunctionComponent, option: IDropdownOption) => setDefaultLanguage(option.key as never) @@ -211,7 +215,7 @@ export const FullTextPoliciesComponent: React.FunctionComponent, option: IDropdownOption) => onFullTextPathPolicyChange(index, option) @@ -229,11 +233,30 @@ export const FullTextPoliciesComponent: React.FunctionComponent { - return [ +export const getFullTextLanguageOptions = (englishOnly?: boolean): IDropdownOption[] => { + const multiLanguageSupportEnabled: boolean = isFullTextSearchPreviewFeaturesEnabled() && !englishOnly; + const fullTextLanguageOptions: IDropdownOption[] = [ { key: "en-US", text: "English (US)", }, + ...(multiLanguageSupportEnabled + ? [ + { + key: "fr-FR", + text: "French", + }, + { + key: "de-DE", + text: "German", + }, + { + key: "es-ES", + text: "Spanish", + }, + ] + : []), ]; + + return fullTextLanguageOptions; }; diff --git a/src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx b/src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx index 6162361d6..5ab433785 100644 --- a/src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx +++ b/src/Explorer/Panes/AddCollectionPanel/AddCollectionPanel.tsx @@ -893,6 +893,8 @@ export class AddCollectionPanel extends React.Component { this.setState({ fullTextPolicy, fullTextIndexes, fullTextPolicyValidated }); }} + // Remove when multi language support on container create issue is fixed + englishOnly={true} /> diff --git a/src/Explorer/Panes/AddCollectionPanel/__snapshots__/AddCollectionPanel.test.tsx.snap b/src/Explorer/Panes/AddCollectionPanel/__snapshots__/AddCollectionPanel.test.tsx.snap index c4cfa4afa..97ae169ca 100644 --- a/src/Explorer/Panes/AddCollectionPanel/__snapshots__/AddCollectionPanel.test.tsx.snap +++ b/src/Explorer/Panes/AddCollectionPanel/__snapshots__/AddCollectionPanel.test.tsx.snap @@ -516,6 +516,7 @@ exports[`AddCollectionPanel should render Default properly 1`] = ` } > { (isCapabilityEnabled(Constants.CapabilityNames.EnableNoSQLVectorSearch) || isFabricNative()) ); }; + +export const isFullTextSearchPreviewFeaturesEnabled = (): boolean => { + return ( + userContext.apiType === "SQL" && + isCapabilityEnabled(Constants.CapabilityNames.EnableNoSQLFullTextSearchPreviewFeatures) + ); +};