git.iko.soy/typeable/bloodhound
on master help sign in
cleanup, making cabal shut the fuck up
commit3ec86b38d09d6ac1f8f1c124073928f540db99d1 authorChris Allen <cma@bitemyapp.com> dateFri 4 Apr 2014, 23:01 (13 years ago) parente2a6348
2 files changed+16−16
Database/Bloodhound/Client.hs+15−16 bloodhound.cabal+1
Database/Bloodhound/Client.hs+15−16
@@ -58,16 +58,16 @@ muhServer = "http://localhost:9200"
5858
5959-- bloo <- (liftM responseBody $ parseUrl "http://localhost:9200/" >>= \r -> withManager (httpLbs r))
6060
61−rootPath :: String
62−rootPath = rollUp $ ["/"]
61+-- rootPath :: String
62+-- rootPath = rollUp $ ["/"]
6363
64−-- Kinda hate this.
65−pathFromType :: String -> String -> String
66−pathFromType index docType = "/" ++ index ++ docType
64+-- -- Kinda hate this.
65+-- pathFromType :: String -> String -> String
66+-- pathFromType index docType = "/" ++ index ++ docType
6767
68−-- Kinda hate this too.
69−rollUp :: [String] -> String
70−rollUp = Prelude.concat
68+-- -- Kinda hate this too.
69+-- rollUp :: [String] -> String
70+-- rollUp = Prelude.concat
7171
7272main = simpleHttp "http://localhost:9200/events/event/_search?q=hostname:localhost&size=1" >>= L.putStrLn
7373
@@ -154,28 +154,28 @@ joinPath path = concat $ intersperse "/" path
154154
155155getStatus :: Server -> IO (Maybe (Status Version))
156156getStatus (Server server) = do
157− request <- parseUrl $ server ++ rootPath
157+ request <- parseUrl $ joinPath [server]
158158 response <- withManager $ httpLbs request
159159 return $ (decode $ responseBody response)
160160
161161createIndex :: Server -> IndexSettings -> IndexName -> IO Reply
162162createIndex (Server server) indexSettings indexName =
163163 dispatch url method body where
164− url = server ++ "/" ++ indexName
164+ url = joinPath [server, indexName]
165165 method = NHTM.methodPut
166166 body = Just $ encode indexSettings
167167
168168deleteIndex :: Server -> IndexName -> IO Reply
169169deleteIndex (Server server) indexName =
170170 dispatch url method body where
171− url = server ++ "/" ++ indexName
171+ url = joinPath [server, indexName]
172172 method = NHTM.methodDelete
173173 body = Nothing
174174
175175indexExists :: Server -> IndexName -> IO Bool
176176indexExists (Server server) indexName =
177177 exists where
178− url = server ++ "/" ++ indexName
178+ url = joinPath [server, indexName]
179179 method = NHTM.methodHead
180180 body = Nothing
181181 reply = dispatch url method body
@@ -195,7 +195,7 @@ openOrCloseIndexes :: OpenCloseIndex -> Server -> IndexName -> IO Reply
195195openOrCloseIndexes oci (Server server) indexName =
196196 dispatch url method body where
197197 ociString = stringifyOCIndex oci
198− url = server ++ "/" ++ indexName ++ "/" ++ ociString
198+ url = joinPath [server, indexName, ociString]
199199 method = NHTM.methodPost
200200 body = Nothing
201201
@@ -211,15 +211,14 @@ createMapping :: ToJSON a => Server -> IndexName
211211 -> MappingName -> a -> IO Reply
212212createMapping (Server server) indexName mappingName mapping =
213213 dispatch url method body where
214− url = server ++ "/" ++ indexName ++ "/"
215− ++ mappingName ++ "/" ++ "_mapping"
214+ url = joinPath [server, indexName, mappingName, "_mapping"]
216215 method = NHTM.methodPut
217216 body = Just $ encode mapping
218217
219218deleteMapping :: Server -> IndexName -> MappingName -> IO Reply
220219deleteMapping (Server server) indexName mappingName =
221220 dispatch url method body where
222− url = server ++ "/" ++ indexName ++ "/" ++ mappingName ++ "/" ++ "_mapping"
221+ url = joinPath [server, indexName, mappingName, "_mapping"]
223222 method = NHTM.methodDelete
224223 body = Nothing
225224
bloodhound.cabal+1
@@ -46,3 +46,4 @@ test-suite tests
4646 hspec >= 1.9,
4747 http-conduit,
4848 http-types
49+ default-language: Haskell2010