mirror of
https://github.com/immich-app/immich.git
synced 2025-12-16 01:10:57 +03:00
fix(web): recent search doesn't use search type
This commit is contained in:
@@ -79,10 +79,25 @@
|
||||
searchStore.isSearchEnabled = false;
|
||||
};
|
||||
|
||||
function buildSearchPayload(term: string): SmartSearchDto | MetadataSearchDto {
|
||||
const searchType = getSearchType();
|
||||
switch (searchType) {
|
||||
case 'smart':
|
||||
return { query: term } as SmartSearchDto;
|
||||
case 'metadata':
|
||||
return { originalFileName: term } as MetadataSearchDto;
|
||||
case 'description':
|
||||
return { description: term } as MetadataSearchDto;
|
||||
case 'ocr':
|
||||
return { ocr: term } as MetadataSearchDto;
|
||||
default:
|
||||
return { query: term } as SmartSearchDto;
|
||||
}
|
||||
}
|
||||
|
||||
const onHistoryTermClick = async (searchTerm: string) => {
|
||||
value = searchTerm;
|
||||
const searchPayload = { query: searchTerm };
|
||||
await handleSearch(searchPayload);
|
||||
await handleSearch(buildSearchPayload(searchTerm));
|
||||
};
|
||||
|
||||
const onFilterClick = async () => {
|
||||
@@ -112,29 +127,7 @@
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
const searchType = getSearchType();
|
||||
let payload = {} as SmartSearchDto | MetadataSearchDto;
|
||||
|
||||
switch (searchType) {
|
||||
case 'smart': {
|
||||
payload = { query: value } as SmartSearchDto;
|
||||
break;
|
||||
}
|
||||
case 'metadata': {
|
||||
payload = { originalFileName: value } as MetadataSearchDto;
|
||||
break;
|
||||
}
|
||||
case 'description': {
|
||||
payload = { description: value } as MetadataSearchDto;
|
||||
break;
|
||||
}
|
||||
case 'ocr': {
|
||||
payload = { ocr: value } as MetadataSearchDto;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
handlePromiseError(handleSearch(payload));
|
||||
handlePromiseError(handleSearch(buildSearchPayload(value)));
|
||||
saveSearchTerm(value);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user