mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Remove obsolete endpoint
Search by index is the same as a search with only a `content:` expression.
This commit is contained in:
@ -3028,40 +3028,6 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/ItemLightList"
|
$ref: "#/components/schemas/ItemLightList"
|
||||||
|
|
||||||
/sec/item/searchIndex:
|
|
||||||
post:
|
|
||||||
operationId: "sec-item-search-index"
|
|
||||||
tags: [ Item Search ]
|
|
||||||
summary: Search for items using full-text search only.
|
|
||||||
description: |
|
|
||||||
Search for items by only using the full-text search index.
|
|
||||||
|
|
||||||
Unlike the other search routes, this one only asks the
|
|
||||||
full-text search index and returns only one group that
|
|
||||||
contains the results in the same order as given from the
|
|
||||||
index. Most full-text search engines use an ordering that
|
|
||||||
reflect the relevance wrt the search term.
|
|
||||||
|
|
||||||
The other search routes always order the results by some
|
|
||||||
property (the item date) and thus the relevance ordering is
|
|
||||||
destroyed when using the full-text search.
|
|
||||||
security:
|
|
||||||
- authTokenHeader: []
|
|
||||||
requestBody:
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/ItemQuery"
|
|
||||||
responses:
|
|
||||||
422:
|
|
||||||
description: BadRequest
|
|
||||||
200:
|
|
||||||
description: Ok
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
$ref: "#/components/schemas/ItemLightList"
|
|
||||||
|
|
||||||
/sec/item/searchStats:
|
/sec/item/searchStats:
|
||||||
post:
|
post:
|
||||||
operationId: "sec-item-search-stats-get"
|
operationId: "sec-item-search-stats-get"
|
||||||
|
@ -13,7 +13,6 @@ import cats.implicits._
|
|||||||
import docspell.backend.BackendApp
|
import docspell.backend.BackendApp
|
||||||
import docspell.backend.auth.AuthToken
|
import docspell.backend.auth.AuthToken
|
||||||
import docspell.backend.ops.OCustomFields.{RemoveValue, SetValue}
|
import docspell.backend.ops.OCustomFields.{RemoveValue, SetValue}
|
||||||
import docspell.backend.ops.OFulltext
|
|
||||||
import docspell.backend.ops.OItemSearch.{Batch, Query}
|
import docspell.backend.ops.OItemSearch.{Batch, Query}
|
||||||
import docspell.backend.ops.OSimpleSearch
|
import docspell.backend.ops.OSimpleSearch
|
||||||
import docspell.backend.ops.OSimpleSearch.StringSearchResult
|
import docspell.backend.ops.OSimpleSearch.StringSearchResult
|
||||||
@ -107,30 +106,6 @@ object ItemRoutes {
|
|||||||
resp <- searchItemStats(backend, dsl)(settings, fixQuery, itemQuery)
|
resp <- searchItemStats(backend, dsl)(settings, fixQuery, itemQuery)
|
||||||
} yield resp
|
} yield resp
|
||||||
|
|
||||||
case req @ POST -> Root / "searchIndex" =>
|
|
||||||
for {
|
|
||||||
mask <- req.as[ItemQuery]
|
|
||||||
limitCapped = mask.limit.exists(_ > cfg.maxItemPageSize)
|
|
||||||
resp <- mask.query match {
|
|
||||||
case q if q.length > 1 =>
|
|
||||||
val ftsIn = OFulltext.FtsInput(q)
|
|
||||||
val batch = Batch(
|
|
||||||
mask.offset.getOrElse(0),
|
|
||||||
mask.limit.getOrElse(cfg.maxItemPageSize)
|
|
||||||
).restrictLimitTo(cfg.maxItemPageSize)
|
|
||||||
for {
|
|
||||||
items <- backend.fulltext
|
|
||||||
.findIndexOnly(cfg.maxNoteLength)(ftsIn, user.account, batch)
|
|
||||||
ok <- Ok(
|
|
||||||
Conversions.mkItemListWithTagsFtsPlain(items, batch, limitCapped)
|
|
||||||
)
|
|
||||||
} yield ok
|
|
||||||
|
|
||||||
case _ =>
|
|
||||||
BadRequest(BasicResult(false, "Query string too short"))
|
|
||||||
}
|
|
||||||
} yield resp
|
|
||||||
|
|
||||||
case GET -> Root / Ident(id) =>
|
case GET -> Root / Ident(id) =>
|
||||||
for {
|
for {
|
||||||
item <- backend.itemSearch.findItem(id, user.account.collective)
|
item <- backend.itemSearch.findItem(id, user.account.collective)
|
||||||
|
Reference in New Issue
Block a user