git.iko.soy/typeable/bloodhound
on master help sign in
errors and cleanup
commitbf74b956b140ceb8a40ef5e471567b10024eeb90 authorChris Allen <cma@bitemyapp.com> dateMon 7 Apr 2014, 20:37 (13 years ago) parentbfaeb92
2 files changed+15−8
Database/Bloodhound/Client.hs+14−7 tests/tests.hs+1−1
Database/Bloodhound/Client.hs+14−7
@@ -334,8 +334,8 @@ data Filter = AndFilter [Filter] (Maybe Cache)
334334 | OrFilter [Filter] (Maybe Cache)
335335 | BoolFilter BoolMatch (Maybe Cache)
336336 | ExistsFilter FieldName -- always cached
337− | GeoBoundingBoxFilter FieldName GeoBoundingBoxConstraint GeoFilterType (Maybe Cache)
338− | GeoDistanceFilter FieldName LatLon Distance (Maybe Cache)
337+ | GeoBoundingBoxFilter GeoBoundingBoxConstraint GeoFilterType (Maybe Cache)
338+ | GeoDistanceFilter GeoConstraint Distance (Maybe Cache)
339339 deriving (Show)
340340
341341-- I dunno.
@@ -350,14 +350,19 @@ data BoolMatch = MustMatch Term
350350data GeoFilterType = GeoFilterMemory | GeoFilterIndexed deriving (Show)
351351
352352data LatLon = LatLon { lat :: Double, lon :: Double } deriving (Show)
353−data GeoBoundingBox = { topLeft :: LatLon
354− , bottomRight :: LatLon } deriving (Show)
353+data GeoBoundingBox =
354+ GeoBoundingBox { topLeft :: LatLon
355+ , bottomRight :: LatLon } deriving (Show)
355356
356357data GeoBoundingBoxConstraint =
357− GeoBoundingBoxConstraint { geoField :: Text
358+ GeoBoundingBoxConstraint { geoField :: FieldName
358359 , constraintBox :: GeoBoundingBox
359360 } deriving (Show)
360361
362+data GeoConstraint =
363+ GeoConstraint { geoField :: FieldName
364+ , latLon :: LatLon } deriving (Show)
365+
361366data DistanceUnits = Miles
362367 | Yards
363368 | Feet
@@ -373,8 +378,10 @@ data DistanceType = Arc | SloppyArc | Plane deriving (Show)
373378-- geo_point?
374379data OptimizeBbox = GeoFilterType | NoOptimizeBbox deriving (Show)
375380
376−data Distance = { coefficient :: Double
377− , unit :: DistanceUnits } deriving (Show)
381+data Distance =
382+ Distance { coefficient :: Double
383+ , unit :: DistanceUnits } deriving (Show)
384+
378385-- This is turning into a fractal of horror
379386-- data Fuzziness = FDateFuzziness DateFuzziness |
380387
tests/tests.hs+1−1
@@ -55,4 +55,4 @@ main = hspec $ do
5555 docInserted <- getDocument (Server "http://localhost:9200") "twitter" "tweet" "1"
5656 let newTweet = decode (responseBody docInserted) :: Maybe (EsResult Tweet)
5757 deleted <- deleteExampleIndex
58− (Just tweet) `shouldBe` (fmap _source newTweet)
58+ Just tweet `shouldBe` fmap _source newTweet