git.iko.soy/typeable/bloodhound
on master help sign in
bump Cabal, document getDocument
8ef1968Chris Allen
.travis.yml+10−10
@@ -22,7 +22,7 @@ env:
22before_install:
22before_install:
23 - sudo add-apt-repository -y ppa:hvr/ghc
23 - sudo add-apt-repository -y ppa:hvr/ghc
24 - sudo apt-get update
24 - sudo apt-get update
25− - sudo apt-get install cabal-install-1.18 ghc-$GHCVER
25+ - sudo apt-get install cabal-install-1.20 ghc-$GHCVER
26 - sudo apt-get install happy-1.19.3
26 - sudo apt-get install happy-1.19.3
27 - export PATH=/opt/ghc/$GHCVER/bin:/opt/happy/1.19.3/bin:$PATH
27 - export PATH=/opt/ghc/$GHCVER/bin:/opt/happy/1.19.3/bin:$PATH
28 - wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$ESVER.deb
28 - wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-$ESVER.deb
@@ -30,31 +30,31 @@ before_install:
30 - sudo service elasticsearch start
30 - sudo service elasticsearch start
31
31
32install:
32install:
33− - cabal-1.18 update
33+ - cabal-1.20 update
34− - cabal-1.18 install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls
34+ - cabal-1.20 install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls
35
35
36# Here starts the actual work to be performed for the package under
36# Here starts the actual work to be performed for the package under
37# test; any command which exits with a non-zero exit code causes the
37# test; any command which exits with a non-zero exit code causes the
38# build to fail.
38# build to fail.
39script:
39script:
40 # -v2 provides useful information for debugging
40 # -v2 provides useful information for debugging
41− - cabal-1.18 configure --enable-tests --enable-benchmarks -v2
41+ - cabal-1.20 configure --enable-tests --enable-benchmarks -v2
42
42
43 # this builds all libraries and executables
43 # this builds all libraries and executables
44 # (including tests/benchmarks)
44 # (including tests/benchmarks)
45− - cabal-1.18 build
45+ - cabal-1.20 build
46
46
47− - cabal-1.18 test
47+ - cabal-1.20 test
48− - cabal-1.18 check
48+ - cabal-1.20 check
49
49
50 # tests that a source-distribution can be generated
50 # tests that a source-distribution can be generated
51− - cabal-1.18 sdist
51+ - cabal-1.20 sdist
52
52
53 # check that the generated source-distribution can be built & installed
53 # check that the generated source-distribution can be built & installed
54− - export SRC_TGZ=$(cabal-1.18 info . | awk '{print $2 ".tar.gz";exit}') ;
54+ - export SRC_TGZ=$(cabal-1.20 info . | awk '{print $2 ".tar.gz";exit}') ;
55 cd dist/;
55 cd dist/;
56 if [ -f "$SRC_TGZ" ]; then
56 if [ -f "$SRC_TGZ" ]; then
57− cabal-1.18 install "$SRC_TGZ";
57+ cabal-1.20 install "$SRC_TGZ";
58 else
58 else
59 echo "expected '$SRC_TGZ' not found";
59 echo "expected '$SRC_TGZ' not found";
60 exit 1;
60 exit 1;
src/Database/Bloodhound/Client.hs+5−1
@@ -350,7 +350,11 @@ encodeBulkOperation (BulkUpdate (IndexName indexName)
350 doc = object ["doc" .= value]
350 doc = object ["doc" .= value]
351 blob = encode metadata `mappend` "\n" `mappend` encode doc
351 blob = encode metadata `mappend` "\n" `mappend` encode doc
352
352
353−
353+-- | 'getDocument' is a straight-forward way to fetch a single document from
354+-- Elasticsearch using a 'Server', 'IndexName', 'MappingName', and a 'DocId'.
355+-- The 'DocId' is the primary key for your Elasticsearch document.
356+--
357+-- >>> yourDoc <- getDocument testServer testIndex testMapping (DocId "1")
354getDocument :: Server -> IndexName -> MappingName
358getDocument :: Server -> IndexName -> MappingName
355 -> DocId -> IO Reply
359 -> DocId -> IO Reply
356getDocument (Server server) (IndexName indexName)
360getDocument (Server server) (IndexName indexName)