mirror of
https://github.com/immich-app/immich.git
synced 2025-12-17 01:11:13 +03:00
fix(web): recent search doesn't use search type
This commit is contained in:
@@ -79,10 +79,25 @@
|
|||||||
searchStore.isSearchEnabled = false;
|
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) => {
|
const onHistoryTermClick = async (searchTerm: string) => {
|
||||||
value = searchTerm;
|
value = searchTerm;
|
||||||
const searchPayload = { query: searchTerm };
|
await handleSearch(buildSearchPayload(searchTerm));
|
||||||
await handleSearch(searchPayload);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFilterClick = async () => {
|
const onFilterClick = async () => {
|
||||||
@@ -112,29 +127,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
const searchType = getSearchType();
|
handlePromiseError(handleSearch(buildSearchPayload(value)));
|
||||||
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));
|
|
||||||
saveSearchTerm(value);
|
saveSearchTerm(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user