mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 18:38:26 +00:00
Make the text length limit optional
This commit is contained in:
@ -578,7 +578,7 @@ object QItem {
|
||||
)
|
||||
)(
|
||||
Select(
|
||||
select(substring(m.content.s, 0, maxLen).s, tagsTid.s, tagsName.s),
|
||||
select(contentMax(maxLen), tagsTid.s, tagsName.s),
|
||||
from(i)
|
||||
.innerJoin(a, a.itemId === i.id)
|
||||
.innerJoin(m, a.id === m.id)
|
||||
@ -597,7 +597,7 @@ object QItem {
|
||||
): ConnectionIO[TextAndTag] =
|
||||
readTextAndTag(collective, itemId, pageSep) {
|
||||
Select(
|
||||
select(substring(m.content.s, 0, maxLen).s, org.oid.s, org.name.s),
|
||||
select(contentMax(maxLen), org.oid.s, org.name.s),
|
||||
from(i)
|
||||
.innerJoin(a, a.itemId === i.id)
|
||||
.innerJoin(m, m.id === a.id)
|
||||
@ -614,7 +614,7 @@ object QItem {
|
||||
): ConnectionIO[TextAndTag] =
|
||||
readTextAndTag(collective, itemId, pageSep) {
|
||||
Select(
|
||||
select(substring(m.content.s, 0, maxLen).s, pers0.pid.s, pers0.name.s),
|
||||
select(contentMax(maxLen), pers0.pid.s, pers0.name.s),
|
||||
from(i)
|
||||
.innerJoin(a, a.itemId === i.id)
|
||||
.innerJoin(m, m.id === a.id)
|
||||
@ -631,7 +631,7 @@ object QItem {
|
||||
): ConnectionIO[TextAndTag] =
|
||||
readTextAndTag(collective, itemId, pageSep) {
|
||||
Select(
|
||||
select(substring(m.content.s, 0, maxLen).s, pers0.pid.s, pers0.name.s),
|
||||
select(contentMax(maxLen), pers0.pid.s, pers0.name.s),
|
||||
from(i)
|
||||
.innerJoin(a, a.itemId === i.id)
|
||||
.innerJoin(m, m.id === a.id)
|
||||
@ -648,7 +648,7 @@ object QItem {
|
||||
): ConnectionIO[TextAndTag] =
|
||||
readTextAndTag(collective, itemId, pageSep) {
|
||||
Select(
|
||||
select(substring(m.content.s, 0, maxLen).s, equip.eid.s, equip.name.s),
|
||||
select(contentMax(maxLen), equip.eid.s, equip.name.s),
|
||||
from(i)
|
||||
.innerJoin(a, a.itemId === i.id)
|
||||
.innerJoin(m, m.id === a.id)
|
||||
@ -657,6 +657,12 @@ object QItem {
|
||||
)
|
||||
}
|
||||
|
||||
private def contentMax(maxLen: Int): SelectExpr =
|
||||
if (maxLen <= 0) {
|
||||
logger.debug("Max text length limit disabled")
|
||||
m.content.s
|
||||
} else substring(m.content.s, 0, maxLen).s
|
||||
|
||||
private def readTextAndTag(collective: Ident, itemId: Ident, pageSep: String)(
|
||||
q: Select
|
||||
): ConnectionIO[TextAndTag] =
|
||||
|
Reference in New Issue
Block a user