Add new search term that searches in all meta data

A field that searches via substring search in names of correspondents
and concerned meta data.
This commit is contained in:
Eike Kettner 2020-06-13 16:49:03 +02:00
parent 35c9409680
commit f30c8a5e4d
3 changed files with 19 additions and 1 deletions

View File

@ -3354,6 +3354,8 @@ components:
- outgoing
name:
type: string
allNames:
type: string
corrOrg:
type: string
format: ident

View File

@ -121,6 +121,7 @@ trait Conversions {
m.dateUntil,
m.dueDateFrom,
m.dueDateUntil,
m.allNames,
None
)

View File

@ -164,6 +164,7 @@ object QItem {
dateTo: Option[Timestamp],
dueDateFrom: Option[Timestamp],
dueDateTo: Option[Timestamp],
allNames: Option[String],
orderAsc: Option[RItem.Columns.type => Column]
)
@ -184,6 +185,7 @@ object QItem {
None,
None,
None,
None,
None
)
}
@ -282,7 +284,8 @@ object QItem {
RTagItem.Columns.tagId.isOneOf(q.tagsExclude)
)
val name = q.name.map(queryWildcard)
val name = q.name.map(queryWildcard)
val allNames = q.allNames.map(queryWildcard)
val cond = and(
IC.cid.prefix("i").is(q.collective),
IC.state.prefix("i").isOneOf(q.states),
@ -290,6 +293,18 @@ object QItem {
name
.map(n => or(IC.name.prefix("i").lowerLike(n), IC.notes.prefix("i").lowerLike(n)))
.getOrElse(Fragment.empty),
allNames
.map(n =>
or(
OC.name.prefix("o0").lowerLike(n),
PC.name.prefix("p0").lowerLike(n),
PC.name.prefix("p1").lowerLike(n),
EC.name.prefix("e1").lowerLike(n),
IC.name.prefix("i").lowerLike(n),
IC.notes.prefix("i").lowerLike(n)
)
)
.getOrElse(Fragment.empty),
RPerson.Columns.pid.prefix("p0").isOrDiscard(q.corrPerson),
ROrganization.Columns.oid.prefix("o0").isOrDiscard(q.corrOrg),
RPerson.Columns.pid.prefix("p1").isOrDiscard(q.concPerson),