git.iko.soy/typeable/bloodhound
on master help sign in
warning squashing, terms query
commit610c4c8bc79db02b91546add4fb56c18212d9ec4 authorChris Allen <cma@bitemyapp.com> dateWed 4 Jun 2014, 05:29 (12 years ago) parentfd1c921
1 file changed+16−11
Database/Bloodhound/Types/Instances.hs+16−11
Database/Bloodhound/Types/Instances.hs+16−11
@@ -50,25 +50,25 @@ instance ToJSON Filter where
5050 object ["geo_bounding_box" .= toJSON bbConstraint
5151 , "type" .= toJSON filterType]
5252
53− toJSON (GeoDistanceFilter (GeoPoint (FieldName distanceGeoField) latLon)
53+ toJSON (GeoDistanceFilter (GeoPoint (FieldName distanceGeoField) geoDistLatLon)
5454 distance distanceType optimizeBbox cache) =
5555 object ["geo_distance" .=
5656 object ["distance" .= toJSON distance
5757 , "distance_type" .= toJSON distanceType
5858 , "optimize_bbox" .= optimizeBbox
59− , distanceGeoField .= toJSON latLon
59+ , distanceGeoField .= toJSON geoDistLatLon
6060 , "_cache" .= cache]]
6161
6262 toJSON (GeoDistanceRangeFilter (GeoPoint (FieldName gddrField) drLatLon)
63− (DistanceRange distanceFrom drDistanceTo)) =
63+ (DistanceRange geoDistRangeDistFrom drDistanceTo)) =
6464 object ["geo_distance_range" .=
65− object ["from" .= toJSON distanceFrom
65+ object ["from" .= toJSON geoDistRangeDistFrom
6666 , "to" .= toJSON drDistanceTo
6767 , gddrField .= toJSON drLatLon]]
6868
69− toJSON (GeoPolygonFilter (FieldName geoField) latLons) =
69+ toJSON (GeoPolygonFilter (FieldName geoPolygonFilterField) latLons) =
7070 object ["geo_polygon" .=
71− object [geoField .=
71+ object [geoPolygonFilterField .=
7272 object ["points" .= fmap toJSON latLons]]]
7373
7474 toJSON (IdsFilter (MappingName mappingName) values) =
@@ -120,19 +120,24 @@ instance ToJSON Filter where
120120 , "_cache_key" .= cacheKey]]
121121
122122instance ToJSON GeoPoint where
123− toJSON (GeoPoint (FieldName geoField) latLon) =
124− object [ geoField .= toJSON latLon ]
123+ toJSON (GeoPoint (FieldName geoPointField) geoPointLatLon) =
124+ object [ geoPointField .= toJSON geoPointLatLon ]
125125
126126
127127instance ToJSON Query where
128− toJSON (TermQuery (Term termField termValue) boost) =
128+ toJSON (TermQuery (Term termQueryField termQueryValue) boost) =
129129 object [ "term" .=
130− object [termField .= object merged]]
130+ object [termQueryField .= object merged]]
131131 where
132− base = [ "value" .= termValue ]
132+ base = [ "value" .= termQueryValue ]
133133 boosted = maybe [] (return . ("boost" .=)) boost
134134 merged = mappend base boosted
135135
136+ toJSON (TermsQuery terms termsQueryMinimumMatch) =
137+ object [ "terms" .= object conjoined ]
138+ where conjoined = [ "tags" .= fmap toJSON terms
139+ , "minimum_should_match" .= toJSON termsQueryMinimumMatch ]
140+
136141 toJSON (QueryMatchQuery matchQuery) =
137142 object [ "match" .= toJSON matchQuery ]
138143