use block comment
This commit is contained in:
parent
b74fd71d67
commit
1dc5623713
|
@ -220,17 +220,17 @@ export class SearchService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.filetype) {
|
if (opts.filetype) {
|
||||||
// this is very ugly, but the "correct" solution would
|
/* this is very ugly, but the "correct" solution would
|
||||||
// be `and exists (select 1 from
|
be `and exists (select 1 from
|
||||||
// unnest(note."attachedFileTypes") x(t) where t like
|
unnest(note."attachedFileTypes") x(t) where t like
|
||||||
// :type)` and I can't find a way to get TypeORM to
|
:type)` and I can't find a way to get TypeORM to
|
||||||
// generate that; this hack works because `~*` is
|
generate that; this hack works because `~*` is
|
||||||
// "regexp match, ignoring case" and the stringified
|
"regexp match, ignoring case" and the stringified
|
||||||
// version of an array of varchars (which is what
|
version of an array of varchars (which is what
|
||||||
// `attachedFileTypes` is) looks like `{foo,bar}`, so
|
`attachedFileTypes` is) looks like `{foo,bar}`, so
|
||||||
// we're looking for opts.filetype as the first half
|
we're looking for opts.filetype as the first half of
|
||||||
// of a MIME type, either at start of the array (after
|
a MIME type, either at start of the array (after the
|
||||||
// the `{`) or later (after a `,`)
|
`{`) or later (after a `,`) */
|
||||||
query.andWhere(`note."attachedFileTypes"::varchar ~* :type`, { type: `[{,]${opts.filetype}/` });
|
query.andWhere(`note."attachedFileTypes"::varchar ~* :type`, { type: `[{,]${opts.filetype}/` });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue