mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-24 11:28:25 +00:00
Allo wildcards when searching by attachment ids
This commit is contained in:
@ -171,12 +171,16 @@ object ItemQueryGenerator {
|
||||
tables.item.id.in(select.withSelect(Nel.of(RItem.as("i").id.s)))
|
||||
|
||||
case Expr.AttachId(id) =>
|
||||
tables.item.id.in(
|
||||
Select(
|
||||
select(RAttachment.T.itemId),
|
||||
from(RAttachment.T),
|
||||
val idWildcard = QueryWildcard(id)
|
||||
val query =
|
||||
if (id == idWildcard) {
|
||||
RAttachment.T.id.cast[String] === id
|
||||
).distinct
|
||||
} else {
|
||||
RAttachment.T.id.cast[String].like(idWildcard)
|
||||
}
|
||||
|
||||
tables.item.id.in(
|
||||
Select(select(RAttachment.T.itemId), from(RAttachment.T), query).distinct
|
||||
)
|
||||
|
||||
case Expr.Fulltext(_) =>
|
||||
|
Reference in New Issue
Block a user