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 - outgoing
name: name:
type: string type: string
allNames:
type: string
corrOrg: corrOrg:
type: string type: string
format: ident format: ident

View File

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

View File

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