-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: search by description #15818
feat: search by description #15818
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ok. It might be nicer to have a drop-down instead of a radio group
server/src/entities/asset.entity.ts
Outdated
@@ -396,6 +396,9 @@ export function searchAssetBuilder(kysely: Kysely<DB>, options: AssetSearchBuild | |||
sql`'%' || f_unaccent(${options.originalFileName}) || '%'`, | |||
), | |||
) | |||
.$if(!!options.description, (qb) => | |||
qb.innerJoin('exif', 'assets.id', 'exif.assetId').where('exif.description', 'ilike', `%${options.description}%`), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably want to escape the value being passed in in case there's a %
in the string? Otherwise searching for 100%
will return descriptions containing 100
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this happens automatically by the library
There should be an |
Add an option to search by description using postgresql text search
TODO