git.iko.soy/typeable/bloodhound
on master help sign in
Merge branch 'master' into directGenerators
commitf022a5249c8089869fc407436a018aa258c3182a authorChris Allen <cma@bitemyapp.com> dateThu 8 Feb 2018, 17:41 (9 years ago) parentecabdbe3be3d8f
6 files changed+38−22
.travis.yml+2 bloodhound.cabal+1−1 changelog.md+11 src/Database/V1/Bloodhound/Client.hs+11−8 src/Database/V5/Bloodhound/Client.hs+11−12 stack-8.2.yaml+2−1
.travis.yml+2
@@ -20,6 +20,8 @@ env:
2020 - GHCVER=8.0 ESVER=5.0.2 STACK_YAML=stack-8.0.yaml ESFLAG=ES5 DLINK=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch ES_JAVA_OPTS="-Xms500m -Xmx750m"
2121 - GHCVER=8.2 ESVER=1.7.6 STACK_YAML=stack.yaml ESFLAG=ES1 DLINK=https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch
2222 - GHCVER=8.2 ESVER=5.0.2 STACK_YAML=stack.yaml ESFLAG=ES5 DLINK=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch ES_JAVA_OPTS="-Xms500m -Xmx750m"
23+ - GHCVER=8.2 ESVER=5.5.0 STACK_YAML=stack.yaml ESFLAG=ES5 DLINK=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch ES_JAVA_OPTS="-Xms500m -Xmx750m"
24+ - GHCVER=8.2 ESVER=6.1.3 STACK_YAML=stack.yaml ESFLAG=ES5 DLINK=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch ES_JAVA_OPTS="-Xms500m -Xmx750m"
2325
2426install:
2527 # stack
bloodhound.cabal+1−1
@@ -55,7 +55,7 @@ library
5555 text >= 0.11 && <1.3,
5656 mtl >= 1.0 && <2.3,
5757 transformers >= 0.2 && <0.6,
58− http-types >= 0.8 && <0.11,
58+ http-types >= 0.8 && <0.13,
5959 vector >= 0.10.9 && <0.13,
6060 scientific >= 0.3.0.0 && <0.4.0.0,
6161 exceptions,
changelog.md+11
@@ -1,3 +1,14 @@
1+0.15.0.2
2+========
3+- @michaelxavier
4+ - Allow http-types 0.12
5+
6+0.15.0.1
7+========
8+- @bitemyapp
9+ - Allow http-types 0.11
10+ - Removed unused `oPath` function
11+
1120.15.0.0
213===================
314
src/Database/V1/Bloodhound/Client.hs+11−8
@@ -583,14 +583,17 @@ listIndices :: (MonadThrow m, MonadBH m) => m [IndexName]
583583listIndices =
584584 parse . responseBody =<< get =<< url
585585 where
586− url = joinPath ["_cat/indices?v"]
587− -- parses the tabular format the indices api provides
588− parse body = case T.lines (T.decodeUtf8 (L.toStrict body)) of
589− (hdr:rows) -> let ks = T.words hdr
590− keyedRows = [ HM.fromList (zip ks (T.words row)) | row <- rows ]
591− names = catMaybes (HM.lookup "index" <$> keyedRows)
592− in return (IndexName <$> names)
593− [] -> throwM (EsProtocolException body)
586+ url = joinPath ["_cat/indices?format=json"]
587+ parse body = maybe (throwM (EsProtocolException body)) return $ do
588+ vals <- decode body
589+ forM vals $ \val -> do
590+ case val of
591+ Object obj -> do
592+ indexVal <- HM.lookup "index" obj
593+ case indexVal of
594+ String txt -> Just (IndexName txt)
595+ _ -> Nothing
596+ _ -> Nothing
594597
595598-- | 'updateIndexAliases' updates the server's index alias
596599-- table. Operations are atomic. Explained in further detail at
src/Database/V5/Bloodhound/Client.hs+11−12
@@ -532,10 +532,6 @@ createIndexWith updates shards (IndexName indexName) =
532532 )
533533 ]
534534
535−oPath :: ToJSON a => NonEmpty Text -> a -> Value
536−oPath (k :| []) v = object [k .= v]
537−oPath (k:| (h:t)) v = object [k .= oPath (h :| t) v]
538−
539535-- | 'deleteIndex' will delete an index given a 'Server', and an 'IndexName'.
540536--
541537-- >>> _ <- runBH' $ createIndex defaultIndexSettings (IndexName "didimakeanindex")
@@ -703,14 +699,17 @@ listIndices :: (MonadThrow m, MonadBH m) => m [IndexName]
703699listIndices =
704700 parse . responseBody =<< get =<< url
705701 where
706− url = joinPath ["_cat/indices?v"]
707− -- parses the tabular format the indices api provides
708− parse body = case T.lines (T.decodeUtf8 (L.toStrict body)) of
709− (hdr:rows) -> let ks = T.words hdr
710− keyedRows = [ HM.fromList (zip ks (T.words row)) | row <- rows ]
711− names = catMaybes (HM.lookup "index" <$> keyedRows)
712− in return (IndexName <$> names)
713− [] -> throwM (EsProtocolException body)
702+ url = joinPath ["_cat/indices?format=json"]
703+ parse body = maybe (throwM (EsProtocolException body)) return $ do
704+ vals <- decode body
705+ forM vals $ \val -> do
706+ case val of
707+ Object obj -> do
708+ indexVal <- HM.lookup "index" obj
709+ case indexVal of
710+ String txt -> Just (IndexName txt)
711+ _ -> Nothing
712+ _ -> Nothing
714713
715714-- | 'updateIndexAliases' updates the server's index alias
716715-- table. Operations are atomic. Explained in further detail at
stack-8.2.yaml+2−1
@@ -7,6 +7,7 @@ packages:
77 - './examples'
88
99extra-deps:
10−- quickcheck-properties-0.1
10+ - quickcheck-properties-0.1
11+ - http-types-0.12
1112
1213resolver: lts-10.0