Skip to content

Commit 34b2225

Browse files
prepare 0.4.2
1 parent aa6040c commit 34b2225

File tree

12 files changed

+328
-24
lines changed

12 files changed

+328
-24
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ are used for versioning (schema follows below):
1515
0.3.4 to 0.4).
1616
- All backwards incompatible changes are mentioned in this document.
1717

18+
0.4.2
19+
-----
20+
2017-09-28
21+
22+
- Added ``geo_bounding_box`` query support to the geo-spatial features.
23+
1824
0.4.1
1925
-----
2026
2017-09-26

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ Main features and highlights
4343
``lte``, ``endswith``, ``contains``, ``wildcard``, ``exists``, ``exclude``,
4444
``isnull``, ``range``, ``in``, ``term`` and ``terms`` is implemented.
4545
- :doc:`Geo-spatial filtering filter backend <advanced_usage_examples>` (the
46-
following filters implemented: ``geo_distance``, ``geo_polygon``).
46+
following filters implemented: ``geo_distance``, ``geo_polygon`` and
47+
``geo_bounding_box``).
4748
- :doc:`Geo-spatial ordering filter backend <advanced_usage_examples>` (the
4849
following filters implemented: ``geo_distance``).
4950
- :doc:`Faceted search filter backend <advanced_usage_examples>`.

advanced_usage_examples.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,14 @@ Filter documents that are located in the given polygon.
740740
741741
http://localhost:8000/search/publishers/?location__geo_polygon=40,-70|30,-80|20,-90
742742
743+
**Geo-bounding-box filtering**
744+
745+
Filter documents that are located in the given bounding box.
746+
747+
.. code-block:: text
748+
749+
http://localhost:8000/search/publishers/?location__geo_bounding_box=44.87,40.07|43.87,41.11
750+
743751
Ordering
744752
~~~~~~~~
745753

docs/advanced_usage_examples.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,14 @@ Filter documents that are located in the given polygon.
740740
741741
http://localhost:8000/search/publishers/?location__geo_polygon=40,-70|30,-80|20,-90
742742
743+
**Geo-bounding-box filtering**
744+
745+
Filter documents that are located in the given bounding box.
746+
747+
.. code-block:: text
748+
749+
http://localhost:8000/search/publishers/?location__geo_bounding_box=44.87,40.07|43.87,41.11
750+
743751
Ordering
744752
~~~~~~~~
745753

docs/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ are used for versioning (schema follows below):
1515
0.3.4 to 0.4).
1616
- All backwards incompatible changes are mentioned in this document.
1717

18+
0.4.2
19+
-----
20+
2017-09-28
21+
22+
- Added ``geo_bounding_box`` query support to the geo-spatial features.
23+
1824
0.4.1
1925
-----
2026
2017-09-26

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ Main features and highlights
4343
``lte``, ``endswith``, ``contains``, ``wildcard``, ``exists``, ``exclude``,
4444
``isnull``, ``range``, ``in``, ``term`` and ``terms`` is implemented.
4545
- :doc:`Geo-spatial filtering filter backend <advanced_usage_examples>` (the
46-
following filters implemented: ``geo_distance``, ``geo_polygon``).
46+
following filters implemented: ``geo_distance``, ``geo_polygon`` and
47+
``geo_bounding_box``).
4748
- :doc:`Geo-spatial ordering filter backend <advanced_usage_examples>` (the
4849
following filters implemented: ``geo_distance``).
4950
- :doc:`Faceted search filter backend <advanced_usage_examples>`.

examples/simple/search_indexes/viewsets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
LOOKUP_FILTER_WILDCARD,
66
LOOKUP_FILTER_GEO_DISTANCE,
77
LOOKUP_FILTER_GEO_POLYGON,
8+
LOOKUP_FILTER_GEO_BOUNDING_BOX,
89
LOOKUP_QUERY_IN,
910
LOOKUP_QUERY_GT,
1011
LOOKUP_QUERY_GTE,
@@ -290,8 +291,10 @@ class PublisherDocumentViewSet(BaseDocumentViewSet):
290291
geo_spatial_filter_fields = {
291292
'location': {
292293
'lookups': [
294+
LOOKUP_FILTER_GEO_BOUNDING_BOX,
293295
LOOKUP_FILTER_GEO_DISTANCE,
294296
LOOKUP_FILTER_GEO_POLYGON,
297+
295298
],
296299
},
297300
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import find_packages, setup
44

5-
version = '0.4.1'
5+
version = '0.4.2'
66

77
DOCS_TRANSFORMATIONS = (
88
(

src/django_elasticsearch_dsl_drf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
__title__ = 'django-elasticsearch-dsl-drf'
6-
__version__ = '0.4.1'
6+
__version__ = '0.4.2'
77
__author__ = 'Artur Barseghyan <[email protected]>'
88
__copyright__ = '2017 Artur Barseghyan'
99
__license__ = 'GPL 2.0/LGPL 2.1'

src/django_elasticsearch_dsl_drf/constants.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'EXTENDED_STRING_LOOKUP_FILTERS',
1616
'FALSE_VALUES',
1717
'LOOKUP_FILTER_EXISTS',
18+
'LOOKUP_FILTER_GEO_BOUNDING_BOX',
1819
'LOOKUP_FILTER_GEO_DISTANCE',
1920
'LOOKUP_FILTER_GEO_POLYGON',
2021
'LOOKUP_FILTER_PREFIX',
@@ -194,9 +195,11 @@
194195

195196
# Draws a circle around the specified location and finds all documents that
196197
# have a geo-point within that circle.
198+
#
197199
# The `geo_distance` filter. Accepts three values (distance|lat|lon)
198200
# separated by `SEPARATOR_LOOKUP_VALUE`.
199201
# https://www.elastic.co/guide/en/elasticsearch/guide/current/geo-distance.html
202+
#
200203
# Example:
201204
#
202205
# {
@@ -249,14 +252,60 @@
249252
# }
250253
#
251254
# Query options:
255+
#
252256
# - _name: Optional name field to identify the filter
253257
# - validation_method: Set to IGNORE_MALFORMED to accept geo points with
254258
# invalid latitude or longitude, COERCE to try and infer correct latitude or
255259
# longitude, or STRICT (default is STRICT).
260+
#
256261
# Example: http://localhost:8000
257262
# /api/articles/?location__geo_polygon=40,-70|30,-80|20,-90
258263
LOOKUP_FILTER_GEO_POLYGON = 'geo_polygon'
259264

265+
# Geo Bounding Box Query
266+
# A query allowing to filter hits based on a point location using a bounding
267+
# box. Assuming the following indexed document:
268+
#
269+
# Example:
270+
#
271+
# {
272+
# "query": {
273+
# "bool" : {
274+
# "must" : {
275+
# "match_all" : {}
276+
# },
277+
# "filter" : {
278+
# "geo_bounding_box" : {
279+
# "location" : {
280+
# "top_left" : {
281+
# "lat" : 40.73,
282+
# "lon" : -74.1
283+
# },
284+
# "bottom_right" : {
285+
# "lat" : 40.01,
286+
# "lon" : -71.12
287+
# }
288+
# }
289+
# }
290+
# }
291+
# }
292+
# }
293+
# }
294+
#
295+
# Query options:
296+
#
297+
# - _name: Optional name field to identify the filter
298+
# - validation_method: Set to IGNORE_MALFORMED to accept geo points with
299+
# invalid latitude or longitude, COERCE to try and infer correct latitude or
300+
# longitude, or STRICT (default is STRICT).
301+
# - type: Set to one of indexed or memory to defines whether this filter will
302+
# be executed in memory or indexed. See Type below for further details.
303+
# Default is memory.
304+
#
305+
# Example: http://localhost:8000
306+
# /api/articles/?location__geo_bounding_box=40.73,-74.1|40.01,-71.12
307+
LOOKUP_FILTER_GEO_BOUNDING_BOX = 'geo_bounding_box'
308+
260309
# ****************************************************************************
261310
# ************************ Functional filters/queries ************************
262311
# ****************************************************************************
@@ -372,6 +421,7 @@
372421
)
373422

374423
ALL_GEO_SPATIAL_LOOKUP_FILTERS_AND_QUERIES = (
424+
LOOKUP_FILTER_GEO_BOUNDING_BOX,
375425
LOOKUP_FILTER_GEO_DISTANCE,
376426
LOOKUP_FILTER_GEO_POLYGON,
377427
)

0 commit comments

Comments
 (0)