Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #270 from nahap/master

added optimize_bbox to geodistanceFilter and 'sum' to score types in TopChildrenQuery
  • Loading branch information...
commit b7cd8f7fdd3f2b959088b3acdd7fd2806db8dbe2 2 parents 4a7fc25 + 5fa542b
Alberto Paro authored
Showing with 7 additions and 2 deletions.
  1. +6 −1 pyes/filters.py
  2. +1 −1  pyes/query.py
7 pyes/filters.py
View
@@ -361,7 +361,7 @@ class GeoDistanceFilter(Filter):
_internal_name = "geo_distance"
- def __init__(self, field, location, distance, distance_type="arc", distance_unit=None, **kwargs):
+ def __init__(self, field, location, distance, distance_type="arc", distance_unit=None, optimize_bbox="memory", **kwargs):
super(GeoDistanceFilter, self).__init__(**kwargs)
self.field = field
self.location = location
@@ -382,6 +382,11 @@ def _serialize(self):
raise QueryParameterError("Invalid distance_unit")
params["unit"] = self.distance_unit
+ if self.optimize_bbox:
+ if self.optimize_bbox not in ["memory", "indexed"]:
+ raise QueryParameterError("Invalid optimize_bbox")
+ params['optimize_bbox'] = self.optimize_bbox
+
return params
2  pyes/query.py
View
@@ -430,7 +430,7 @@ def __init__(self, type, score="max", factor=5, incremental_factor=2, **kwargs):
self.incremental_factor = incremental_factor
def _serialize(self):
- if self.score not in ["max", "min", "avg"]:
+ if self.score not in ["max", "min", "avg", "sum"]:
raise InvalidParameterQuery("Invalid value '%s' for score" % self.score)
filters = {}
Please sign in to comment.
Something went wrong with that request. Please try again.