Compare commits

..

3 Commits

Author SHA1 Message Date
Asier Isayas
8ba75c0594 vector search float16 2025-11-05 08:02:13 -08:00
Asier Isayas
c142e4ad8a Merge branch 'master' of https://github.com/Azure/cosmos-explorer 2025-10-17 11:39:32 -07:00
Asier Isayas
fb95b44242 Add multiple languages for Full Text Search Policy 2025-10-17 11:39:25 -07:00
11 changed files with 47 additions and 105 deletions

View File

@@ -89,7 +89,7 @@ export class CapabilityNames {
public static readonly EnableMongo: string = "EnableMongo"; public static readonly EnableMongo: string = "EnableMongo";
public static readonly EnableServerless: string = "EnableServerless"; public static readonly EnableServerless: string = "EnableServerless";
public static readonly EnableNoSQLVectorSearch: string = "EnableNoSQLVectorSearch"; public static readonly EnableNoSQLVectorSearch: string = "EnableNoSQLVectorSearch";
public static readonly EnableNoSQLFullTextSearchPreviewFeatures: string = "EnableNoSQLFullTextSearchPreviewFeatures"; public static readonly EnableNoSQLFullTextSearch: string = "EnableNoSQLFullTextSearch";
} }
export enum CapacityMode { export enum CapacityMode {

View File

@@ -389,7 +389,7 @@ export interface VectorEmbeddingPolicy {
} }
export interface VectorEmbedding { export interface VectorEmbedding {
dataType: "float32" | "uint8" | "int8"; dataType: "float32" | "float16" | "uint8" | "int8";
dimensions: number; dimensions: number;
distanceFunction: "euclidean" | "cosine" | "dotproduct"; distanceFunction: "euclidean" | "cosine" | "dotproduct";
path: string; path: string;

View File

@@ -12,7 +12,6 @@ import {
import { FullTextIndex, FullTextPath, FullTextPolicy } from "Contracts/DataModels"; import { FullTextIndex, FullTextPath, FullTextPolicy } from "Contracts/DataModels";
import { CollapsibleSectionComponent } from "Explorer/Controls/CollapsiblePanel/CollapsibleSectionComponent"; import { CollapsibleSectionComponent } from "Explorer/Controls/CollapsiblePanel/CollapsibleSectionComponent";
import * as React from "react"; import * as React from "react";
import { isFullTextSearchPreviewFeaturesEnabled } from "Utils/CapabilityUtils";
export interface FullTextPoliciesComponentProps { export interface FullTextPoliciesComponentProps {
fullTextPolicy: FullTextPolicy; fullTextPolicy: FullTextPolicy;
@@ -234,29 +233,24 @@ export const FullTextPoliciesComponent: React.FunctionComponent<FullTextPolicies
}; };
export const getFullTextLanguageOptions = (englishOnly?: boolean): IDropdownOption[] => { export const getFullTextLanguageOptions = (englishOnly?: boolean): IDropdownOption[] => {
const multiLanguageSupportEnabled: boolean = isFullTextSearchPreviewFeaturesEnabled() && !englishOnly;
const fullTextLanguageOptions: IDropdownOption[] = [ const fullTextLanguageOptions: IDropdownOption[] = [
{ {
key: "en-US", key: "en-US",
text: "English (US)", text: "English (US)",
}, },
...(multiLanguageSupportEnabled {
? [ key: "fr-FR",
{ text: "French",
key: "fr-FR", },
text: "French", {
}, key: "de-DE",
{ text: "German",
key: "de-DE", },
text: "German", {
}, key: "es-ES",
{ text: "Spanish",
key: "es-ES", },
text: "Spanish",
},
]
: []),
]; ];
return fullTextLanguageOptions; return englishOnly ? [fullTextLanguageOptions[0]] : fullTextLanguageOptions;
}; };

View File

@@ -1,6 +1,6 @@
import { IDropdownOption } from "@fluentui/react"; import { IDropdownOption } from "@fluentui/react";
const dataTypes = ["float32", "uint8", "int8"]; const dataTypes = ["float32", "float16", "uint8", "int8"];
const distanceFunctions = ["euclidean", "cosine", "dotproduct"]; const distanceFunctions = ["euclidean", "cosine", "dotproduct"];
const indexTypes = ["none", "flat", "diskANN", "quantizedFlat"]; const indexTypes = ["none", "flat", "diskANN", "quantizedFlat"];

View File

@@ -893,7 +893,6 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
) => { ) => {
this.setState({ fullTextPolicy, fullTextIndexes, fullTextPolicyValidated }); this.setState({ fullTextPolicy, fullTextIndexes, fullTextPolicyValidated });
}} }}
// Remove when multi language support on container create issue is fixed
englishOnly={true} englishOnly={true}
/> />
</Stack> </Stack>

View File

@@ -516,7 +516,6 @@ exports[`AddCollectionPanel should render Default properly 1`] = `
} }
> >
<FullTextPoliciesComponent <FullTextPoliciesComponent
englishOnly={true}
fullTextPolicy={ fullTextPolicy={
{ {
"defaultLanguage": "en-US", "defaultLanguage": "en-US",

View File

@@ -13,7 +13,6 @@ import {
IToggleStyles, IToggleStyles,
Position, Position,
SpinButton, SpinButton,
Stack,
Toggle, Toggle,
} from "@fluentui/react"; } from "@fluentui/react";
import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, makeStyles } from "@fluentui/react-components"; import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, makeStyles } from "@fluentui/react-components";
@@ -1164,20 +1163,14 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
</AccordionHeader> </AccordionHeader>
<AccordionPanel> <AccordionPanel>
<div className={styles.settingsSectionContainer}> <div className={styles.settingsSectionContainer}>
<Stack horizontal verticalAlign="center" tokens={{ childrenGap: 4 }}> <Checkbox
<Checkbox styles={{ label: { padding: 0 } }}
styles={{ label: { padding: 0 } }} className="padding"
className="padding" ariaLabel="Ignore partition key on document update"
ariaLabel="Ignore partition key on document update" checked={ignorePartitionKeyOnDocumentUpdate}
checked={ignorePartitionKeyOnDocumentUpdate} onChange={handleOnIgnorePartitionKeyOnDocumentUpdateChange}
onChange={handleOnIgnorePartitionKeyOnDocumentUpdateChange} label="Ignore partition key on document update"
label="Ignore partition key on document update" />
/>
<InfoTooltip className={styles.headerIcon}>
If checked, the partition key value will not be used to locate the document during update
operations. Only use this if document updates are failing due to an abnormal partition key.
</InfoTooltip>
</Stack>
</div> </div>
</AccordionPanel> </AccordionPanel>
</AccordionItem> </AccordionItem>

View File

@@ -589,35 +589,20 @@ exports[`Settings Pane should render Default properly 1`] = `
<div <div
className="___1dfa554_0000000 fo7qwa0" className="___1dfa554_0000000 fo7qwa0"
> >
<Stack <StyledCheckboxBase
horizontal={true} ariaLabel="Ignore partition key on document update"
tokens={ checked={false}
className="padding"
label="Ignore partition key on document update"
onChange={[Function]}
styles={
{ {
"childrenGap": 4, "label": {
"padding": 0,
},
} }
} }
verticalAlign="center" />
>
<StyledCheckboxBase
ariaLabel="Ignore partition key on document update"
checked={false}
className="padding"
label="Ignore partition key on document update"
onChange={[Function]}
styles={
{
"label": {
"padding": 0,
},
}
}
/>
<InfoTooltip
className="___vtc5hy0_0000000 f10ra9hq f1k6fduh"
>
If checked, the partition key value will not be used to locate the document during update operations. Only use this if document updates are failing due to an abnormal partition key.
</InfoTooltip>
</Stack>
</div> </div>
</AccordionPanel> </AccordionPanel>
</AccordionItem> </AccordionItem>
@@ -898,35 +883,20 @@ exports[`Settings Pane should render Gremlin properly 1`] = `
<div <div
className="___1dfa554_0000000 fo7qwa0" className="___1dfa554_0000000 fo7qwa0"
> >
<Stack <StyledCheckboxBase
horizontal={true} ariaLabel="Ignore partition key on document update"
tokens={ checked={false}
className="padding"
label="Ignore partition key on document update"
onChange={[Function]}
styles={
{ {
"childrenGap": 4, "label": {
"padding": 0,
},
} }
} }
verticalAlign="center" />
>
<StyledCheckboxBase
ariaLabel="Ignore partition key on document update"
checked={false}
className="padding"
label="Ignore partition key on document update"
onChange={[Function]}
styles={
{
"label": {
"padding": 0,
},
}
}
/>
<InfoTooltip
className="___vtc5hy0_0000000 f10ra9hq f1k6fduh"
>
If checked, the partition key value will not be used to locate the document during update operations. Only use this if document updates are failing due to an abnormal partition key.
</InfoTooltip>
</Stack>
</div> </div>
</AccordionPanel> </AccordionPanel>
</AccordionItem> </AccordionItem>

View File

@@ -13,7 +13,7 @@ import {
import { Upload } from "Common/Upload/Upload"; import { Upload } from "Common/Upload/Upload";
import { UploadDetailsRecord } from "Contracts/ViewModels"; import { UploadDetailsRecord } from "Contracts/ViewModels";
import { logConsoleError } from "Utils/NotificationConsoleUtils"; import { logConsoleError } from "Utils/NotificationConsoleUtils";
import React, { ChangeEvent, FunctionComponent, useReducer, useState } from "react"; import React, { ChangeEvent, FunctionComponent, useState } from "react";
import { getErrorMessage } from "../../Tables/Utilities"; import { getErrorMessage } from "../../Tables/Utilities";
import { useSelectedNode } from "../../useSelectedNode"; import { useSelectedNode } from "../../useSelectedNode";
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm"; import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
@@ -57,7 +57,6 @@ export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({ onUpl
const [uploadFileData, setUploadFileData] = useState<UploadDetailsRecord[]>([]); const [uploadFileData, setUploadFileData] = useState<UploadDetailsRecord[]>([]);
const [formError, setFormError] = useState<string>(""); const [formError, setFormError] = useState<string>("");
const [isExecuting, setIsExecuting] = useState<boolean>(); const [isExecuting, setIsExecuting] = useState<boolean>();
const [reducer, setReducer] = useReducer((x) => x + 1, 1);
const onSubmit = () => { const onSubmit = () => {
setFormError(""); setFormError("");
@@ -76,7 +75,6 @@ export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({ onUpl
(uploadDetails) => { (uploadDetails) => {
setUploadFileData(uploadDetails.data); setUploadFileData(uploadDetails.data);
setFiles(undefined); setFiles(undefined);
setReducer(); // Trigger a re-render to update the UI with new upload details
// Emit the upload details to the parent component // Emit the upload details to the parent component
onUpload && onUpload(uploadDetails.data); onUpload && onUpload(uploadDetails.data);
}, },
@@ -97,7 +95,6 @@ export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({ onUpl
const props: RightPaneFormProps = { const props: RightPaneFormProps = {
formError, formError,
isExecuting: isExecuting, isExecuting: isExecuting,
isSubmitButtonDisabled: !files || files.length === 0,
submitButtonText: "Upload", submitButtonText: "Upload",
onSubmit, onSubmit,
}; };
@@ -195,7 +192,6 @@ export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({ onUpl
<RightPaneForm {...props}> <RightPaneForm {...props}>
<div className="paneMainContent"> <div className="paneMainContent">
<Upload <Upload
key={reducer} // Force re-render on state change
label="Select JSON Files" label="Select JSON Files"
onUpload={updateSelectedFiles} onUpload={updateSelectedFiles}
accept="application/json" accept="application/json"

View File

@@ -3,7 +3,6 @@
exports[`Upload Items Pane should render Default properly 1`] = ` exports[`Upload Items Pane should render Default properly 1`] = `
<RightPaneForm <RightPaneForm
formError="" formError=""
isSubmitButtonDisabled={true}
onSubmit={[Function]} onSubmit={[Function]}
submitButtonText="Upload" submitButtonText="Upload"
> >
@@ -12,7 +11,6 @@ exports[`Upload Items Pane should render Default properly 1`] = `
> >
<Upload <Upload
accept="application/json" accept="application/json"
key="1"
label="Select JSON Files" label="Select JSON Files"
multiple={true} multiple={true}
onUpload={[Function]} onUpload={[Function]}

View File

@@ -24,10 +24,3 @@ export const isVectorSearchEnabled = (): boolean => {
(isCapabilityEnabled(Constants.CapabilityNames.EnableNoSQLVectorSearch) || isFabricNative()) (isCapabilityEnabled(Constants.CapabilityNames.EnableNoSQLVectorSearch) || isFabricNative())
); );
}; };
export const isFullTextSearchPreviewFeaturesEnabled = (): boolean => {
return (
userContext.apiType === "SQL" &&
isCapabilityEnabled(Constants.CapabilityNames.EnableNoSQLFullTextSearchPreviewFeatures)
);
};