mirror of
https://github.com/typeable/bloodhound.git
synced 2024-09-11 08:25:32 +03:00
cleaning up as usual
This commit is contained in:
parent
d6d411200c
commit
1ed7096774
@ -169,6 +169,9 @@ deleteIndex (Server server) indexName =
|
||||
method = NHTM.methodDelete
|
||||
body = Nothing
|
||||
|
||||
respIsTwoHunna :: Reply -> Bool
|
||||
respIsTwoHunna resp = (NHTS.statusCode $ responseStatus resp) == 200
|
||||
|
||||
indexExists :: Server -> IndexName -> IO Bool
|
||||
indexExists (Server server) indexName =
|
||||
exists where
|
||||
@ -176,11 +179,7 @@ indexExists (Server server) indexName =
|
||||
method = NHTM.methodHead
|
||||
body = Nothing
|
||||
reply = dispatch url method body
|
||||
exists = do
|
||||
resp <- reply
|
||||
if (NHTS.statusCode $ responseStatus resp) == 200
|
||||
then return True
|
||||
else return False
|
||||
exists = fmap respIsTwoHunna reply
|
||||
|
||||
data OpenCloseIndex = OpenIndex | CloseIndex deriving (Show)
|
||||
|
||||
@ -245,6 +244,16 @@ getDocument (Server server) indexName mappingName docId =
|
||||
method = NHTM.methodGet
|
||||
body = Nothing
|
||||
|
||||
documentExists :: Server -> IndexName -> MappingName
|
||||
-> DocumentID -> IO Bool
|
||||
documentExists (Server server) indexName mappingName docId =
|
||||
exists where
|
||||
url = joinPath [server, indexName, mappingName, docId]
|
||||
method = NHTM.methodHead
|
||||
body = Nothing
|
||||
reply = dispatch url method body
|
||||
exists = fmap respIsTwoHunna reply
|
||||
|
||||
-- getStatus :: String -> IO (Maybe (Status Version))
|
||||
-- getStatus server = do
|
||||
-- request <- parseUrl $ server ++ rootPath
|
||||
|
Loading…
Reference in New Issue
Block a user