Skip to content

Commit 5ced565

Browse files
Similary search, evalutation changes for the new attribute type
1 parent e6e7343 commit 5ced565

File tree

6 files changed

+22
-10
lines changed

6 files changed

+22
-10
lines changed

src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ export default function SimilaritySearchModal() {
9595
filterAttributesSS.forEach((attribute: string) => {
9696
const attributeType = attributes.find(att => att.name == attribute)?.dataType
9797
if (attributeType !== DataTypeEnum.INTEGER) {
98-
operators = operators.filter(operator => operator !== FilterIntegrationOperator.BETWEEN);
99-
tooltips = tooltips.filter(tooltip => tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN));
98+
if (attributeType == DataTypeEnum.TEXT_LIST) {
99+
operators = operators.filter(operator => operator !== FilterIntegrationOperator.BETWEEN && operator !== FilterIntegrationOperator.IN);
100+
tooltips = tooltips.filter(tooltip => tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN) && tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.IN));
101+
} else {
102+
operators = operators.filter(operator => operator !== FilterIntegrationOperator.BETWEEN);
103+
tooltips = tooltips.filter(tooltip => tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN));
104+
}
100105
}
101106
operatorsCopy[attribute] = operators;
102107
tooltipsCopy[attribute] = tooltips;

src/components/projects/projectId/edit-records/EditField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default function EditField(props: EditFieldProps) {
114114
type="checkbox"
115115
className="w-6 "
116116
/>}
117-
{props.attribute.dataType == DataTypeEnum.EMBEDDING_LIST &&
117+
{(props.attribute.dataType == DataTypeEnum.EMBEDDING_LIST || props.attribute.dataType == DataTypeEnum.TEXT_LIST) &&
118118
<textarea value={inputValue} ref={inputRef}
119119
onChange={(e) => setInputValue(e.target.value)}
120120
onInput={setDynamicStyles}

src/components/projects/projectId/edit-records/EditRecords.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default function EditRecords() {
9797
</div>
9898
</div>
9999
<div className="text-gray-800 text-sm mb-4 overflow-anywhere flex">
100-
{attribute.dataType == DataTypeEnum.EMBEDDING_LIST ? (<div className="flex flex-col gap-y-1 divide-y w-full">
100+
{(attribute.dataType == DataTypeEnum.EMBEDDING_LIST || attribute.dataType == DataTypeEnum.TEXT_LIST) ? (<div className="flex flex-col gap-y-1 divide-y w-full">
101101
{record.data[attribute.name].map((item, subKey) => (<div key={subKey} className="pt-1">
102102
{(record.id == erdData.editRecordId && !attribute.isPrimaryKey) ?
103103
<EditField attribute={attribute} record={record} subKey={subKey} erdData={erdData} setErdData={(erdData) => setErdData(erdData)} /> : <>

src/components/projects/projectId/playground/PlaygroundSearchMetaFilterModal.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ export default function PlaygroundSearchMetaFilterModal(props: { selectedEmbeddi
5858
const newTooltipsDict = {};
5959

6060
filterAttributesSS.forEach((attribute) => {
61-
const attributeType = attributes.find(att => att.name == attribute)?.dataType
62-
newOperatorsDict[attribute] = FILTER_INTEGRATION_OPERATORS.filter(operator => attributeType == DataTypeEnum.INTEGER || operator !== FilterIntegrationOperator.BETWEEN);
63-
newTooltipsDict[attribute] = FILTER_INTEGRATION_OPERATOR_TOOLTIPS.filter(tooltip => attributeType == DataTypeEnum.INTEGER || tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN));
61+
const attributeType = attributes.find(att => att.name == attribute)?.dataType;
62+
if (attributeType == DataTypeEnum.TEXT_LIST) {
63+
newOperatorsDict[attribute] = [FilterIntegrationOperator.EQUAL];
64+
newTooltipsDict[attribute] = [getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.EQUAL)];
65+
} else {
66+
newOperatorsDict[attribute] = FILTER_INTEGRATION_OPERATORS.filter(operator => attributeType == DataTypeEnum.INTEGER || operator !== FilterIntegrationOperator.BETWEEN);
67+
newTooltipsDict[attribute] = FILTER_INTEGRATION_OPERATOR_TOOLTIPS.filter(tooltip => attributeType == DataTypeEnum.INTEGER || tooltip !== getFilterIntegrationOperatorTooltip(FilterIntegrationOperator.BETWEEN));
68+
}
6469
colors.push(getColorForDataType(attributeType));
6570
});
6671
setOperatorsDict(newOperatorsDict);

src/components/projects/projectId/settings/embeddings/AddNewEmbeddingModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default function AddNewEmbeddingModal() {
9999

100100
function checkIfAttributeHasToken() {
101101
const attribute = useableEmbedableAttributes.find((a) => a.id == targetAttribute.id);
102-
if (attribute?.dataType == DataTypeEnum.EMBEDDING_LIST) {
102+
if (attribute?.dataType == DataTypeEnum.EMBEDDING_LIST || attribute?.dataType == DataTypeEnum.TEXT_LIST) {
103103
setGranularityArray(GRANULARITY_TYPES_ARRAY.filter((g) => g.value != EmbeddingType.ON_TOKEN));
104104
} else {
105105
checkIfPlatformHasToken();

src/util/components/projects/projectId/data-browser/search-groups-helper.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { SearchGroupElement } from "@/src/types/components/projects/projectId/da
22
import { SearchGroupItem, SearchItemType } from "@/src/types/components/projects/projectId/data-browser/search-groups";
33
import { SearchOperator } from "@/src/types/components/projects/projectId/data-browser/search-operators";
44
import { LabelingTask, LabelingTaskTarget } from "@/src/types/components/projects/projectId/settings/labeling-tasks";
5+
import { DataTypeEnum } from "@/src/types/shared/general";
56
import { getOrderByDisplayName, nameForGroupKeyToString } from "@/submodules/javascript-functions/enums/enum-functions";
67
import { InformationSourceType, SearchGroup, StaticOrderByKeys } from "@/submodules/javascript-functions/enums/enums";
78

@@ -233,8 +234,9 @@ export function orderByCreateSearchGroup(item, globalSearchGroupCount, attribute
233234

234235
function orderByArray(attributesSortOrder: any[] = [], attributesDict: any) {
235236
let array = [];
236-
for (let i = 1; i < attributesSortOrder.length; i++) {
237-
array.push(getOrderByGroup(attributesDict[attributesSortOrder[i].key].name, true, -1)) //1, //-1 desc, 1 asc
237+
const finalAttributesSortOrder = attributesSortOrder.filter((a) => a.type !== DataTypeEnum.TEXT_LIST);
238+
for (let i = 1; i < finalAttributesSortOrder.length; i++) {
239+
array.push(getOrderByGroup(attributesDict[finalAttributesSortOrder[i].key].name, true, -1)) //1, //-1 desc, 1 asc
238240
}
239241
array.push(getOrderByGroup(StaticOrderByKeys.WEAK_SUPERVISION_CONFIDENCE, false, -1));
240242
array.push(getOrderByGroup(StaticOrderByKeys.RANDOM, false, -1));

0 commit comments

Comments
 (0)