mirror of
https://github.com/typeable/bloodhound.git
synced 2024-11-29 23:52:20 +03:00
IdsFilter w/ validation
This commit is contained in:
parent
a800719f53
commit
631b8631e6
@ -375,6 +375,7 @@ data Filter = AndFilter [Filter] Cache
|
||||
| GeoDistanceFilter GeoPoint Distance DistanceType OptimizeBbox Cache
|
||||
| GeoDistanceRangeFilter GeoPoint DistanceRange
|
||||
| GeoPolygonFilter FieldName [LatLon]
|
||||
| IdsFilter MappingName [DocumentID]
|
||||
deriving (Eq, Show)
|
||||
|
||||
class Monoid a => Seminearring a where
|
||||
@ -437,6 +438,11 @@ instance ToJSON Filter where
|
||||
object [geoField .=
|
||||
object ["points" .= fmap toJSON latLons]]]
|
||||
|
||||
toJSON (IdsFilter mappingName values) =
|
||||
object ["ids" .=
|
||||
object ["type" .= mappingName
|
||||
, "values" .= fmap T.pack values]]
|
||||
|
||||
instance ToJSON GeoPoint where
|
||||
toJSON (GeoPoint geoField latLon) =
|
||||
object [geoField .= toJSON latLon]
|
||||
|
18
README.org
18
README.org
@ -6,7 +6,23 @@ Elasticsearch client and query DSL for Haskell
|
||||
|
||||
** Possible future functionality
|
||||
|
||||
Runtime checking for cycles in data structures:
|
||||
*** GeoShapeFilter
|
||||
|
||||
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-geo-shape-filter.html
|
||||
|
||||
*** Geohash cell filter
|
||||
|
||||
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-geohash-cell-filter.html
|
||||
|
||||
*** HasChild Filter
|
||||
|
||||
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-has-child-filter.html
|
||||
|
||||
*** HasParent Filter
|
||||
|
||||
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-has-parent-filter.html
|
||||
|
||||
*** Runtime checking for cycles in data structures
|
||||
|
||||
check for n > 1 occurrences in DFS:
|
||||
|
||||
|
@ -178,3 +178,10 @@ main = hspec $ do
|
||||
let geoFilter = GeoPolygonFilter "tweet.location" points
|
||||
let search = Search Nothing (Just geoFilter)
|
||||
searchExpectNoResults search
|
||||
|
||||
it "returns document for ids filter" $ do
|
||||
_ <- insertData
|
||||
let filter = IdsFilter "tweet" ["1"]
|
||||
let search = Search Nothing (Just filter)
|
||||
myTweet <- searchTweet search
|
||||
myTweet `shouldBe` Right exampleTweet
|
||||
|
Loading…
Reference in New Issue
Block a user