mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Return item notes with search results
In order to not make the response very large, a admin can define a limit on how much to return.
This commit is contained in:
@ -24,6 +24,12 @@ docspell.server {
|
||||
# depending on the available resources.
|
||||
max-item-page-size = 200
|
||||
|
||||
# The number of characters to return for each item notes when
|
||||
# searching. Item notes may be very long, when returning them with
|
||||
# all the results from a search, they add quite some data to return.
|
||||
# In order to keep this low, a limit can be defined here.
|
||||
max-note-length = 180
|
||||
|
||||
# Authentication.
|
||||
auth {
|
||||
|
||||
|
@ -16,6 +16,7 @@ case class Config(
|
||||
auth: Login.Config,
|
||||
integrationEndpoint: Config.IntegrationEndpoint,
|
||||
maxItemPageSize: Int,
|
||||
maxNoteLength: Int,
|
||||
fullTextSearch: Config.FullTextSearch
|
||||
)
|
||||
|
||||
|
@ -197,6 +197,7 @@ trait Conversions {
|
||||
i.folder.map(mkIdName),
|
||||
i.fileCount,
|
||||
Nil,
|
||||
i.notes,
|
||||
Nil
|
||||
)
|
||||
|
||||
|
@ -40,7 +40,7 @@ object ItemRoutes {
|
||||
resp <- mask.fullText match {
|
||||
case Some(fq) if cfg.fullTextSearch.enabled =>
|
||||
for {
|
||||
items <- backend.fulltext.findItems(
|
||||
items <- backend.fulltext.findItems(cfg.maxNoteLength)(
|
||||
query,
|
||||
OFulltext.FtsInput(fq),
|
||||
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
|
||||
@ -49,7 +49,7 @@ object ItemRoutes {
|
||||
} yield ok
|
||||
case _ =>
|
||||
for {
|
||||
items <- backend.itemSearch.findItems(
|
||||
items <- backend.itemSearch.findItems(cfg.maxNoteLength)(
|
||||
query,
|
||||
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
|
||||
)
|
||||
@ -67,7 +67,7 @@ object ItemRoutes {
|
||||
resp <- mask.fullText match {
|
||||
case Some(fq) if cfg.fullTextSearch.enabled =>
|
||||
for {
|
||||
items <- backend.fulltext.findItemsWithTags(
|
||||
items <- backend.fulltext.findItemsWithTags(cfg.maxNoteLength)(
|
||||
query,
|
||||
OFulltext.FtsInput(fq),
|
||||
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
|
||||
@ -76,7 +76,7 @@ object ItemRoutes {
|
||||
} yield ok
|
||||
case _ =>
|
||||
for {
|
||||
items <- backend.itemSearch.findItemsWithTags(
|
||||
items <- backend.itemSearch.findItemsWithTags(cfg.maxNoteLength)(
|
||||
query,
|
||||
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
|
||||
)
|
||||
@ -92,7 +92,7 @@ object ItemRoutes {
|
||||
case q if q.length > 1 =>
|
||||
val ftsIn = OFulltext.FtsInput(q)
|
||||
for {
|
||||
items <- backend.fulltext.findIndexOnly(
|
||||
items <- backend.fulltext.findIndexOnly(cfg.maxNoteLength)(
|
||||
ftsIn,
|
||||
user.account,
|
||||
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
|
||||
|
Reference in New Issue
Block a user