mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Remove search feature flag
This commit is contained in:
@ -34,7 +34,6 @@ case class Config(
|
|||||||
integrationEndpoint: Config.IntegrationEndpoint,
|
integrationEndpoint: Config.IntegrationEndpoint,
|
||||||
maxItemPageSize: Int,
|
maxItemPageSize: Int,
|
||||||
maxNoteLength: Int,
|
maxNoteLength: Int,
|
||||||
featureSearch2: Boolean,
|
|
||||||
fullTextSearch: Config.FullTextSearch,
|
fullTextSearch: Config.FullTextSearch,
|
||||||
adminEndpoint: Config.AdminEndpoint,
|
adminEndpoint: Config.AdminEndpoint,
|
||||||
openid: List[OpenIdConfig],
|
openid: List[OpenIdConfig],
|
||||||
|
@ -40,47 +40,45 @@ final class ItemSearchPart[F[_]: Async](
|
|||||||
private[this] val logger = docspell.logging.getLogger[F]
|
private[this] val logger = docspell.logging.getLogger[F]
|
||||||
|
|
||||||
def routes: HttpRoutes[F] =
|
def routes: HttpRoutes[F] =
|
||||||
if (!cfg.featureSearch2) HttpRoutes.empty
|
HttpRoutes.of {
|
||||||
else
|
case GET -> Root / `searchPath` :? QP.Query(q) :? QP.Limit(limit) :?
|
||||||
HttpRoutes.of {
|
QP.Offset(offset) :? QP.WithDetails(detailFlag) :?
|
||||||
case GET -> Root / `searchPath` :? QP.Query(q) :? QP.Limit(limit) :?
|
QP.SearchKind(searchMode) =>
|
||||||
QP.Offset(offset) :? QP.WithDetails(detailFlag) :?
|
val userQuery =
|
||||||
QP.SearchKind(searchMode) =>
|
ItemQuery(offset, limit, detailFlag, searchMode, q.getOrElse(""))
|
||||||
val userQuery =
|
for {
|
||||||
ItemQuery(offset, limit, detailFlag, searchMode, q.getOrElse(""))
|
today <- Timestamp.current[F].map(_.toUtcDate)
|
||||||
for {
|
resp <- search(userQuery, today)
|
||||||
today <- Timestamp.current[F].map(_.toUtcDate)
|
} yield resp
|
||||||
resp <- search(userQuery, today)
|
|
||||||
} yield resp
|
|
||||||
|
|
||||||
case req @ POST -> Root / `searchPath` =>
|
case req @ POST -> Root / `searchPath` =>
|
||||||
for {
|
for {
|
||||||
timed <- Duration.stopTime[F]
|
timed <- Duration.stopTime[F]
|
||||||
userQuery <- req.as[ItemQuery]
|
userQuery <- req.as[ItemQuery]
|
||||||
today <- Timestamp.current[F].map(_.toUtcDate)
|
today <- Timestamp.current[F].map(_.toUtcDate)
|
||||||
resp <- search(userQuery, today)
|
resp <- search(userQuery, today)
|
||||||
dur <- timed
|
dur <- timed
|
||||||
_ <- logger.debug(s"Search request: ${dur.formatExact}")
|
_ <- logger.debug(s"Search request: ${dur.formatExact}")
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case GET -> Root / `searchStatsPath` :? QP.Query(q) :?
|
case GET -> Root / `searchStatsPath` :? QP.Query(q) :?
|
||||||
QP.SearchKind(searchMode) =>
|
QP.SearchKind(searchMode) =>
|
||||||
val userQuery = ItemQuery(None, None, None, searchMode, q.getOrElse(""))
|
val userQuery = ItemQuery(None, None, None, searchMode, q.getOrElse(""))
|
||||||
for {
|
for {
|
||||||
today <- Timestamp.current[F].map(_.toUtcDate)
|
today <- Timestamp.current[F].map(_.toUtcDate)
|
||||||
resp <- searchStats(userQuery, today)
|
resp <- searchStats(userQuery, today)
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ POST -> Root / `searchStatsPath` =>
|
case req @ POST -> Root / `searchStatsPath` =>
|
||||||
for {
|
for {
|
||||||
timed <- Duration.stopTime[F]
|
timed <- Duration.stopTime[F]
|
||||||
userQuery <- req.as[ItemQuery]
|
userQuery <- req.as[ItemQuery]
|
||||||
today <- Timestamp.current[F].map(_.toUtcDate)
|
today <- Timestamp.current[F].map(_.toUtcDate)
|
||||||
resp <- searchStats(userQuery, today)
|
resp <- searchStats(userQuery, today)
|
||||||
dur <- timed
|
dur <- timed
|
||||||
_ <- logger.debug(s"Search stats request: ${dur.formatExact}")
|
_ <- logger.debug(s"Search stats request: ${dur.formatExact}")
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
|
|
||||||
def searchStats(userQuery: ItemQuery, today: LocalDate): F[Response[F]] = {
|
def searchStats(userQuery: ItemQuery, today: LocalDate): F[Response[F]] = {
|
||||||
val mode = userQuery.searchMode.getOrElse(SearchMode.Normal)
|
val mode = userQuery.searchMode.getOrElse(SearchMode.Normal)
|
||||||
|
Reference in New Issue
Block a user