Remove search UI integration

This commit is contained in:
Manav Rathi 2024-04-11 12:36:37 +05:30
parent 4fff855070
commit 6091ad9cfd
No known key found for this signature in database
4 changed files with 4 additions and 47 deletions

View file

@ -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;

View file

@ -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<Suggestion[]> {
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<Suggestion> {
try {
if (!clipService.isPlatformSupported()) {
@ -389,13 +374,6 @@ async function searchLocationTag(searchPhrase: string): Promise<LocationTag[]> {
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<ClipSearchScores> {
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 };
}

View file

@ -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<number>;
}
export interface MlFileData {
fileId: number;
faces?: Face[];

View file

@ -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