Add new search-index route to web-ui

This commit is contained in:
Eike Kettner
2020-06-23 23:20:34 +02:00
parent d5c9923a6d
commit 6846f2f46e
4 changed files with 78 additions and 12 deletions

View File

@ -45,6 +45,7 @@ module Api exposing
, getTags
, getUsers
, itemDetail
, itemIndexSearch
, itemSearch
, login
, loginSession
@ -104,6 +105,7 @@ import Api.Model.ImapSettings exposing (ImapSettings)
import Api.Model.ImapSettingsList exposing (ImapSettingsList)
import Api.Model.InviteResult exposing (InviteResult)
import Api.Model.ItemDetail exposing (ItemDetail)
import Api.Model.ItemFtsSearch exposing (ItemFtsSearch)
import Api.Model.ItemInsights exposing (ItemInsights)
import Api.Model.ItemLightList exposing (ItemLightList)
import Api.Model.ItemProposals exposing (ItemProposals)
@ -1092,6 +1094,20 @@ moveAttachmentBefore flags itemId data receive =
}
itemIndexSearch :
Flags
-> ItemFtsSearch
-> (Result Http.Error ItemLightList -> msg)
-> Cmd msg
itemIndexSearch flags query receive =
Http2.authPost
{ url = flags.config.baseUrl ++ "/api/v1/sec/item/searchIndex"
, account = getAccount flags
, body = Http.jsonBody (Api.Model.ItemFtsSearch.encode query)
, expect = Http.expectJson receive Api.Model.ItemLightList.decoder
}
itemSearch : Flags -> ItemSearch -> (Result Http.Error ItemLightList -> msg) -> Cmd msg
itemSearch flags search receive =
Http2.authPost