diff --git a/web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx b/web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx index 90239ea28..ca52b9cad 100644 --- a/web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx +++ b/web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx @@ -17,7 +17,7 @@ import { import { Collection } from "types/collection"; import { LocationTagData } from "types/entity"; import { EnteFile } from "types/file"; -import { Person, Thing, WordGroup } from "types/machineLearning"; +import { Person } from "types/machineLearning"; import { ClipSearchScores, DateValue, @@ -146,12 +146,6 @@ export default function SearchInput(props: Iprops) { case SuggestionType.PERSON: search = { person: selectedOption.value as Person }; break; - case SuggestionType.THING: - search = { thing: selectedOption.value as Thing }; - break; - case SuggestionType.TEXT: - search = { text: selectedOption.value as WordGroup }; - break; case SuggestionType.FILE_TYPE: search = { fileType: selectedOption.value as FILE_TYPE }; break; diff --git a/web/apps/photos/src/services/searchService.ts b/web/apps/photos/src/services/searchService.ts index 042f1525d..408c3daa5 100644 --- a/web/apps/photos/src/services/searchService.ts +++ b/web/apps/photos/src/services/searchService.ts @@ -6,7 +6,7 @@ import { t } from "i18next"; import { Collection } from "types/collection"; import { EntityType, LocationTag, LocationTagData } from "types/entity"; import { EnteFile } from "types/file"; -import { Person, Thing } from "types/machineLearning"; +import { Person } from "types/machineLearning"; import { ClipSearchScores, DateValue, @@ -25,7 +25,6 @@ import { clipService, computeClipMatchScore } from "./clip-service"; import { getLocalEmbeddings } from "./embeddingService"; import { getLatestEntities } from "./entityService"; import locationSearchService, { City } from "./locationSearchService"; -import ObjectService from "./machineLearning/objectService"; const DIGITS = new Set(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]); @@ -56,7 +55,6 @@ export const getAutoCompleteSuggestions = getFileNameSuggestion(searchPhrase, files), getFileCaptionSuggestion(searchPhrase, files), ...(await getLocationSuggestions(searchPhrase)), - ...(await getThingSuggestion(searchPhrase)), ].filter((suggestion) => !!suggestion); return convertSuggestionsToOptions(suggestions); @@ -289,19 +287,6 @@ async function getLocationSuggestions(searchPhrase: string) { return [...locationTagSuggestions, ...citySearchSuggestions]; } -async function getThingSuggestion(searchPhrase: string): Promise { - const thingResults = await searchThing(searchPhrase); - - return thingResults.map( - (searchResult) => - ({ - type: SuggestionType.THING, - value: searchResult, - label: searchResult.name, - }) as Suggestion, - ); -} - async function getClipSuggestion(searchPhrase: string): Promise { try { if (!clipService.isPlatformSupported()) { @@ -389,13 +374,6 @@ async function searchLocationTag(searchPhrase: string): Promise { return matchedLocationTags; } -async function searchThing(searchPhrase: string) { - const things = await ObjectService.getAllThings(); - return things.filter((thing) => - thing.name.toLocaleLowerCase().includes(searchPhrase), - ); -} - async function searchClip(searchPhrase: string): Promise { const imageEmbeddings = await getLocalEmbeddings(); const textEmbedding = await clipService.getTextEmbedding(searchPhrase); @@ -445,10 +423,9 @@ function convertSuggestionToSearchQuery(option: Suggestion): Search { case SuggestionType.PERSON: return { person: option.value as Person }; - case SuggestionType.THING: - return { thing: option.value as Thing }; case SuggestionType.FILE_TYPE: return { fileType: option.value as FILE_TYPE }; + case SuggestionType.CLIP: return { clip: option.value as ClipSearchScores }; } diff --git a/web/apps/photos/src/types/machineLearning/index.ts b/web/apps/photos/src/types/machineLearning/index.ts index b452ab0ba..3def20a08 100644 --- a/web/apps/photos/src/types/machineLearning/index.ts +++ b/web/apps/photos/src/types/machineLearning/index.ts @@ -134,17 +134,6 @@ export interface Person { displayImageUrl?: string; } -export interface ObjectDetection { - bbox: [number, number, number, number]; - class: string; - score: number; -} - -export interface WordGroup { - word: string; - files: Array; -} - export interface MlFileData { fileId: number; faces?: Face[]; diff --git a/web/apps/photos/src/types/search/index.ts b/web/apps/photos/src/types/search/index.ts index eec8e0831..97f6d3170 100644 --- a/web/apps/photos/src/types/search/index.ts +++ b/web/apps/photos/src/types/search/index.ts @@ -2,7 +2,7 @@ import { FILE_TYPE } from "constants/file"; import { City } from "services/locationSearchService"; import { LocationTagData } from "types/entity"; import { EnteFile } from "types/file"; -import { Person, Thing, WordGroup } from "types/machineLearning"; +import { Person } from "types/machineLearning"; import { IndexStatus } from "types/machineLearning/ui"; export enum SuggestionType { @@ -12,8 +12,6 @@ export enum SuggestionType { FILE_NAME = "FILE_NAME", PERSON = "PERSON", INDEX_STATUS = "INDEX_STATUS", - THING = "THING", - TEXT = "TEXT", FILE_CAPTION = "FILE_CAPTION", FILE_TYPE = "FILE_TYPE", CLIP = "CLIP", @@ -34,7 +32,6 @@ export interface Suggestion { | number[] | Person | IndexStatus - | WordGroup | LocationTagData | City | FILE_TYPE