Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
use block comment
Browse files Browse the repository at this point in the history
  • Loading branch information
dakkar committed Oct 22, 2023
1 parent b74fd71 commit 1dc5623
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/backend/src/core/SearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,17 @@ export class SearchService {
}

if (opts.filetype) {
// this is very ugly, but the "correct" solution would
// be `and exists (select 1 from
// unnest(note."attachedFileTypes") x(t) where t like
// :type)` and I can't find a way to get TypeORM to
// generate that; this hack works because `~*` is
// "regexp match, ignoring case" and the stringified
// version of an array of varchars (which is what
// `attachedFileTypes` is) looks like `{foo,bar}`, so
// we're looking for opts.filetype as the first half
// of a MIME type, either at start of the array (after
// the `{`) or later (after a `,`)
/* this is very ugly, but the "correct" solution would
be `and exists (select 1 from
unnest(note."attachedFileTypes") x(t) where t like
:type)` and I can't find a way to get TypeORM to
generate that; this hack works because `~*` is
"regexp match, ignoring case" and the stringified
version of an array of varchars (which is what
`attachedFileTypes` is) looks like `{foo,bar}`, so
we're looking for opts.filetype as the first half of
a MIME type, either at start of the array (after the
`{`) or later (after a `,`) */
query.andWhere(`note."attachedFileTypes"::varchar ~* :type`, { type: `[{,]${opts.filetype}/` });
}

Expand Down

0 comments on commit 1dc5623

Please sign in to comment.