feat: search by description (#15818)

* feat: search by description

* wip: mobile

* wip: mobile ui

* wip: mobile search logic

* feat: using f_unaccent

* icon to fit with text search
This commit is contained in:
Alex 2025-02-02 15:18:13 -06:00 committed by GitHub
parent a808a840c8
commit 4efacfbb91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 217 additions and 31 deletions

View file

@ -6,7 +6,7 @@
export type SearchFilter = {
query: string;
queryType: 'smart' | 'metadata';
queryType: 'smart' | 'metadata' | 'description';
personIds: SvelteSet<string>;
tagIds: SvelteSet<string>;
location: SearchLocationFilter;
@ -110,6 +110,7 @@
let payload: SmartSearchDto | MetadataSearchDto = {
query: filter.queryType === 'smart' ? query : undefined,
originalFileName: filter.queryType === 'metadata' ? query : undefined,
description: filter.queryType === 'description' ? query : undefined,
country: filter.location.country,
state: filter.location.state,
city: filter.location.city,

View file

@ -4,7 +4,7 @@
interface Props {
query: string | undefined;
queryType?: 'smart' | 'metadata';
queryType?: 'smart' | 'metadata' | 'description';
}
let { query = $bindable(), queryType = $bindable('smart') }: Props = $props();
@ -21,6 +21,13 @@
bind:group={queryType}
value="metadata"
/>
<RadioButton
name="query-type"
id="description-radio"
label={$t('description')}
bind:group={queryType}
value="description"
/>
</div>
</fieldset>
@ -34,7 +41,7 @@
placeholder={$t('sunrise_on_the_beach')}
bind:value={query}
/>
{:else}
{:else if queryType === 'metadata'}
<label for="file-name-input" class="immich-form-label">{$t('search_by_filename')}</label>
<input
class="immich-form-input hover:cursor-text w-full !mt-1"
@ -45,4 +52,15 @@
bind:value={query}
aria-labelledby="file-name-label"
/>
{:else if queryType === 'description'}
<label for="description-input" class="immich-form-label">{$t('search_by_description')}</label>
<input
class="immich-form-input hover:cursor-text w-full !mt-1"
type="text"
id="description-input"
name="description"
placeholder={$t('search_by_description_example')}
bind:value={query}
aria-labelledby="description-label"
/>
{/if}