Copyright | (c) Mansur Ziatdinov, 2014--2015 |
---|---|
License | Apache-2.0 |
Maintainer | mz+textocat-api@fosslabs.ru |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
There are two kind of functions in this module. Functions that have apostrophe in their names send data to server every time you call them. Functions without them call server only if necessary (e.g. you requested it)
This monadic interface is experimental. If you know how to improve it, please contact author
- data TextocatM m a
- runTextocatM :: (Functor m, MonadIO m) => ByteString -> TextocatM m a -> m a
- type Textocat = TextocatM IO
- runTextocat :: ByteString -> Textocat a -> IO a
- queue' :: (Functor m, MonadIO m) => [Document] -> TextocatM m [Either ErrorMsg BatchStatus]
- request' :: (Functor m, MonadIO m) => BatchID -> TextocatM m (Either ErrorMsg BatchStatus)
- retrieve' :: (Functor m, MonadIO m) => [BatchID] -> TextocatM m (Either ErrorMsg Batch)
- search' :: (Functor m, MonadIO m) => Text -> TextocatM m (Either ErrorMsg SearchResult)
- status :: (Functor m, MonadIO m) => TextocatM m ServiceStatus
- wait' :: (Functor m, MonadIO m) => BatchID -> TextocatM m ()
- queue :: (Functor m, MonadIO m) => [Document] -> TextocatM m ()
- queue1 :: (Functor m, MonadIO m) => Document -> TextocatM m ()
- force :: (Functor m, MonadIO m) => TextocatM m [Either ErrorMsg BatchStatus]
- request :: (Functor m, MonadIO m) => TextocatM m [Either ErrorMsg BatchStatus]
- retrieve :: (Functor m, MonadIO m) => TextocatM m [Either ErrorMsg Batch]
Monad wrappers
General monad transformer
data TextocatM m a
TextocatM is a monad transformer to use Textocat API
over some monad m
and return result a
:: (Functor m, MonadIO m) | |
=> ByteString | API key |
-> TextocatM m a | TextocatM action |
-> m a |
Executes TextocatM actions with given API key
Monad over IO
:: ByteString | API key |
-> Textocat a | Textocat action |
-> IO a |
Executes Textocat actions with given API key
API operations with explicit calls
queue' :: (Functor m, MonadIO m) => [Document] -> TextocatM m [Either ErrorMsg BatchStatus]
Queues documents. Actually, makes call to entityQueue
with
collections divided by 50 documents at most
:: (Functor m, MonadIO m) | |
=> BatchID | Batch |
-> TextocatM m (Either ErrorMsg BatchStatus) |
Requests batch status
Retrieves batches
:: (Functor m, MonadIO m) | |
=> Text | Search query |
-> TextocatM m (Either ErrorMsg SearchResult) |
Search all collections
status :: (Functor m, MonadIO m) => TextocatM m ServiceStatus
Check service status
Helpers
wait' :: (Functor m, MonadIO m) => BatchID -> TextocatM m ()
Waits while batch processing is finished
API operations with implicit calls
force :: (Functor m, MonadIO m) => TextocatM m [Either ErrorMsg BatchStatus]
request :: (Functor m, MonadIO m) => TextocatM m [Either ErrorMsg BatchStatus]