mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-21 18:08:25 +00:00
Introducing fts client into codebase
This commit is contained in:
@ -84,6 +84,10 @@ docspell.server {
|
||||
}
|
||||
}
|
||||
|
||||
fulltext-search {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
# Configuration for the backend.
|
||||
backend {
|
||||
# Enable or disable debugging for e-mail related functionality. This
|
||||
@ -143,5 +147,13 @@ docspell.server {
|
||||
# By default all files are allowed.
|
||||
valid-mime-types = [ ]
|
||||
}
|
||||
|
||||
# Configuration of the full-text search engine.
|
||||
full-text-search {
|
||||
enabled = true
|
||||
solr = {
|
||||
url = "http://localhost:8983/solr/docspell_core"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -13,7 +13,8 @@ case class Config(
|
||||
backend: BackendConfig,
|
||||
auth: Login.Config,
|
||||
integrationEndpoint: Config.IntegrationEndpoint,
|
||||
maxItemPageSize: Int
|
||||
maxItemPageSize: Int,
|
||||
fulltextSearch: Config.FulltextSearch
|
||||
)
|
||||
|
||||
object Config {
|
||||
@ -50,4 +51,9 @@ object Config {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case class FulltextSearch(enabled: Boolean)
|
||||
|
||||
object FulltextSearch {}
|
||||
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ trait Conversions {
|
||||
m.dueDateFrom,
|
||||
m.dueDateUntil,
|
||||
m.allNames,
|
||||
m.fullText,
|
||||
None,
|
||||
None
|
||||
)
|
||||
|
||||
|
@ -47,10 +47,19 @@ object ItemRoutes {
|
||||
_ <- logger.ftrace(s"Got search mask: $mask")
|
||||
query = Conversions.mkQuery(mask, user.account.collective)
|
||||
_ <- logger.ftrace(s"Running query: $query")
|
||||
items <- backend.itemSearch.findItemsWithTags(
|
||||
query,
|
||||
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
|
||||
)
|
||||
items <- mask.fullText match {
|
||||
case None =>
|
||||
backend.itemSearch.findItemsWithTags(
|
||||
query,
|
||||
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
|
||||
)
|
||||
case Some(fq) =>
|
||||
backend.fulltext.findItemsWithTags(
|
||||
query,
|
||||
fq,
|
||||
Batch(mask.offset, mask.limit).restrictLimitTo(cfg.maxItemPageSize)
|
||||
)
|
||||
}
|
||||
resp <- Ok(Conversions.mkItemListWithTags(items))
|
||||
} yield resp
|
||||
|
||||
|
Reference in New Issue
Block a user