git.iko.soy/typeable/bloodhound
on master help sign in
errors and cleanup
bf74b95Chris Allen
Database/Bloodhound/Client.hs+14−7
@@ -334,8 +334,8 @@ data Filter = AndFilter [Filter] (Maybe Cache)
334 | OrFilter [Filter] (Maybe Cache)
334 | OrFilter [Filter] (Maybe Cache)
335 | BoolFilter BoolMatch (Maybe Cache)
335 | BoolFilter BoolMatch (Maybe Cache)
336 | ExistsFilter FieldName -- always cached
336 | ExistsFilter FieldName -- always cached
337− | GeoBoundingBoxFilter FieldName GeoBoundingBoxConstraint GeoFilterType (Maybe Cache)
337+ | GeoBoundingBoxFilter GeoBoundingBoxConstraint GeoFilterType (Maybe Cache)
338− | GeoDistanceFilter FieldName LatLon Distance (Maybe Cache)
338+ | GeoDistanceFilter GeoConstraint Distance (Maybe Cache)
339 deriving (Show)
339 deriving (Show)
340
340
341-- I dunno.
341-- I dunno.
@@ -350,14 +350,19 @@ data BoolMatch = MustMatch Term
350data GeoFilterType = GeoFilterMemory | GeoFilterIndexed deriving (Show)
350data GeoFilterType = GeoFilterMemory | GeoFilterIndexed deriving (Show)
351
351
352data LatLon = LatLon { lat :: Double, lon :: Double } deriving (Show)
352data LatLon = LatLon { lat :: Double, lon :: Double } deriving (Show)
353−data GeoBoundingBox = { topLeft :: LatLon
353+data GeoBoundingBox =
354+ GeoBoundingBox { topLeft :: LatLon
354− , bottomRight :: LatLon } deriving (Show)
355+ , bottomRight :: LatLon } deriving (Show)
355
356
356data GeoBoundingBoxConstraint =
357data GeoBoundingBoxConstraint =
357− GeoBoundingBoxConstraint { geoField :: Text
358+ GeoBoundingBoxConstraint { geoField :: FieldName
358 , constraintBox :: GeoBoundingBox
359 , constraintBox :: GeoBoundingBox
359 } deriving (Show)
360 } deriving (Show)
360
361
362+data GeoConstraint =
363+ GeoConstraint { geoField :: FieldName
364+ , latLon :: LatLon } deriving (Show)
365+
361data DistanceUnits = Miles
366data DistanceUnits = Miles
362 | Yards
367 | Yards
363 | Feet
368 | Feet
@@ -373,8 +378,10 @@ data DistanceType = Arc | SloppyArc | Plane deriving (Show)
373-- geo_point?
378-- geo_point?
374data OptimizeBbox = GeoFilterType | NoOptimizeBbox deriving (Show)
379data OptimizeBbox = GeoFilterType | NoOptimizeBbox deriving (Show)
375
380
381+data Distance =
376−data Distance = { coefficient :: Double
382+ Distance { coefficient :: Double
377− , unit :: DistanceUnits } deriving (Show)
383+ , unit :: DistanceUnits } deriving (Show)
384+
378-- This is turning into a fractal of horror
385-- This is turning into a fractal of horror
379-- data Fuzziness = FDateFuzziness DateFuzziness |
386-- data Fuzziness = FDateFuzziness DateFuzziness |
380
387
tests/tests.hs+1−1
@@ -55,4 +55,4 @@ main = hspec $ do
55 docInserted <- getDocument (Server "http://localhost:9200") "twitter" "tweet" "1"
55 docInserted <- getDocument (Server "http://localhost:9200") "twitter" "tweet" "1"
56 let newTweet = decode (responseBody docInserted) :: Maybe (EsResult Tweet)
56 let newTweet = decode (responseBody docInserted) :: Maybe (EsResult Tweet)
57 deleted <- deleteExampleIndex
57 deleted <- deleteExampleIndex
58− (Just tweet) `shouldBe` (fmap _source newTweet)
58+ Just tweet `shouldBe` fmap _source newTweet