Skip to content

Commit a4e6874

Browse files
prepare 0.11
1 parent 642fe11 commit a4e6874

File tree

14 files changed

+308
-83
lines changed

14 files changed

+308
-83
lines changed

CHANGELOG.rst

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,36 @@ are used for versioning (schema follows below):
1717

1818
0.11
1919
----
20-
yyyy-mm-dd (not released yet)
20+
2018-07-15
2121

2222
.. note::
2323

24-
This release contains minor backwards incompatible changes.
25-
You should update your code and other parts of your applications
26-
that were relying on the complex queries using `|` and `:` in the
24+
This release contains backwards incompatible changes.
25+
You should update your Django code and front-end parts of your applications
26+
that were relying on the complex queries using `|` and `:` chars in the
2727
GET params.
28+
29+
.. note::
30+
31+
If you have used custom filter backends using `SEPARATOR_LOOKUP_VALUE`
32+
`SEPARATOR_LOOKUP_COMPLEX_VALUE` or
33+
`SEPARATOR_LOOKUP_COMPLEX_MULTIPLE_VALUE` constants or
34+
`split_lookup_complex_value` helper method of the `FilterBackendMixin`,
35+
you most likely want to run your functional tests to see if everything
36+
still works.
37+
38+
.. note::
39+
2840
Do not keep things as they were in your own fork, since new search backends
2941
will use the `|` and `:` symbols differently.
3042

31-
**Old**
43+
**Examples of old API requests vs new API requests**
44+
45+
.. note::
46+
47+
Note, that `|` and `:` chars were mostly replaced with `__` and `,`.
48+
49+
*Old API requests*
3250

3351
.. code-block:: text
3452
@@ -37,8 +55,9 @@ yyyy-mm-dd (not released yet)
3755
http://localhost:8000/api/articles/?id__terms=1|2|3
3856
http://localhost:8000/api/users/?age__range=16|67|2.0
3957
http://localhost:8000/api/articles/?id__in=1|2|3
58+
http://localhost:8000/api/articles/?location__geo_polygon=40,-70|30,-80|20,-90|_name:myname|validation_method:IGNORE_MALFORMED
4059
41-
**New**
60+
*New API requests*
4261

4362
.. code-block:: text
4463
@@ -47,15 +66,21 @@ yyyy-mm-dd (not released yet)
4766
http://localhost:8000/api/articles/?id__terms=1__2__3
4867
http://localhost:8000/api/users/?age__range=16__67__2.0
4968
http://localhost:8000/api/articles/?id__in=1__2__3
50-
69+
http://localhost:8000/api/articles/?location__geo_polygon=40,-70__30,-80__20,-90___name,myname__validation_method,IGNORE_MALFORMED
5170
5271
- `SEPARATOR_LOOKUP_VALUE` has been removed. Use
5372
`SEPARATOR_LOOKUP_COMPLEX_VALUE` and
5473
`SEPARATOR_LOOKUP_COMPLEX_MULTIPLE_VALUE` instead.
5574
- `SEPARATOR_LOOKUP_NAME` has been added.
5675
- The method `split_lookup_complex_value` has been removed. Use
5776
`split_lookup_complex_value` instead.
58-
- Default filter lookup option is added.
77+
- Default filter lookup option is added. In past, if no specific lookup was
78+
provided and there were multiple values for a single field to filter on, by
79+
default `terms` filter was used. The `term` lookup was used by default
80+
in similar situation for a single value to filter on. It's now possible to
81+
declare default lookup which will be used when no lookup is given.
82+
- Removed deprecated `views` module. Import from `viewsets` instead.
83+
- Removed undocumented `get_count` helper from `helpers` module.
5984

6085
0.10
6186
----

docs/advanced_usage_examples.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,11 @@ Search in all fields (``title``, ``description`` and ``summary``) for word
517517
**Search a single term on specific field**
518518

519519
In order to search in specific field (``title``) for term "education", add
520-
the field name separated with ``|`` to the search term.
520+
the field name separated with ``:`` to the search term.
521521

522522
.. code-block:: text
523523
524-
http://127.0.0.1:8080/search/books/?search=title|education
524+
http://127.0.0.1:8080/search/books/?search=title:education
525525
526526
**Search for multiple terms**
527527

@@ -536,11 +536,11 @@ multiple ``search`` query params.
536536

537537
In order to search for multiple terms "education", "technology" in specific
538538
fields add multiple ``search`` query params and field names separated with
539-
``|`` to each of the search terms.
539+
``:`` to each of the search terms.
540540

541541
.. code-block:: text
542542
543-
http://127.0.0.1:8080/search/books/?search=title|education&search=summary|technology
543+
http://127.0.0.1:8080/search/books/?search=title:education&search=summary:technology
544544
545545
**Search with boosting**
546546

@@ -590,7 +590,7 @@ Filter documents by field (``states``) "published" and "in_progress".
590590

591591
.. code-block:: text
592592
593-
http://127.0.0.1:8080/search/books/?state__in=published|in_progress
593+
http://127.0.0.1:8080/search/books/?state__in=published__in_progress
594594
595595
**Filter document by a single field**
596596

@@ -607,7 +607,7 @@ with use of functional ``in`` query filter.
607607

608608
.. code-block:: text
609609
610-
http://127.0.0.1:8080/search/books/?tags__in=education|economy
610+
http://127.0.0.1:8080/search/books/?tags__in=education__economy
611611
612612
You can achieve the same effect by specifying multiple fields (``tags``)
613613
"education" and "economy". Note, that in this case multiple filter terms are
@@ -644,15 +644,15 @@ Order documents by field ``price`` (ascending).
644644

645645
.. code-block:: text
646646
647-
http://127.0.0.1:8080/search/books/?search=title|lorem&ordering=price
647+
http://127.0.0.1:8080/search/books/?search=title:lorem&ordering=price
648648
649649
**Order documents by field (descending)**
650650

651651
Order documents by field ``price`` (descending).
652652

653653
.. code-block:: text
654654
655-
http://127.0.0.1:8080/search/books/?search=title|lorem&ordering=-price
655+
http://127.0.0.1:8080/search/books/?search=title:lorem&ordering=-price
656656
657657
**Order documents by multiple fields**
658658

@@ -662,15 +662,15 @@ the example below, documents would be ordered first by field
662662

663663
.. code-block:: text
664664
665-
http://127.0.0.1:8080/search/books/?search=title|lorem&ordering=-publication_date&ordering=price
665+
http://127.0.0.1:8080/search/books/?search=title:lorem&ordering=-publication_date&ordering=price
666666
667667
Ids filter
668668
----------
669669
Filters documents that only have the provided ids.
670670

671671
.. code-block:: text
672672
673-
http://127.0.0.1:8000/api/articles/?ids=68|64|58
673+
http://127.0.0.1:8000/api/articles/?ids=68__64__58
674674
675675
Or, alternatively:
676676

@@ -881,7 +881,7 @@ Filter documents by field (``states``) "published" and "in_progress".
881881

882882
.. code-block:: text
883883
884-
http://127.0.0.1:8080/search/books/?state_pf__in=published|in_progress
884+
http://127.0.0.1:8080/search/books/?state_pf__in=published__in_progress
885885
886886
Geo-spatial features
887887
--------------------
@@ -900,23 +900,23 @@ Filter documents by radius of 100000km from the given location.
900900

901901
.. code-block:: text
902902
903-
http://localhost:8000/search/publishers/?location__geo_distance=100000km|12.04|-63.93
903+
http://localhost:8000/search/publishers/?location__geo_distance=100000km__12.04__-63.93
904904
905905
**Geo-polygon filtering**
906906

907907
Filter documents that are located in the given polygon.
908908

909909
.. code-block:: text
910910
911-
http://localhost:8000/search/publishers/?location__geo_polygon=40,-70|30,-80|20,-90
911+
http://localhost:8000/search/publishers/?location__geo_polygon=40,-70__30,-80__20,-90
912912
913913
**Geo-bounding-box filtering**
914914

915915
Filter documents that are located in the given bounding box.
916916

917917
.. code-block:: text
918918
919-
http://localhost:8000/search/publishers/?location__geo_bounding_box=44.87,40.07|43.87,41.11
919+
http://localhost:8000/search/publishers/?location__geo_bounding_box=44.87,40.07__43.87,41.11
920920
921921
Ordering
922922
~~~~~~~~
@@ -925,7 +925,7 @@ Ordering
925925

926926
.. code-block:: text
927927
928-
http://localhost:8000/search/publishers/?ordering=location|48.85|2.30|km|plane
928+
http://localhost:8000/search/publishers/?ordering=location__48.85__2.30__km__plane
929929
930930
Suggestions
931931
-----------

docs/basic_usage_examples.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ Search in all fields (``name``, ``address``, ``city``, ``state_province`` and
277277
**Search a single term on specific field**
278278

279279
In order to search in specific field (``name``) for term "reilly", add
280-
the field name separated with ``|`` to the search term.
280+
the field name separated with ``:`` to the search term.
281281

282282
.. code-block:: text
283283
284-
http://127.0.0.1:8080/search/publisher/?search=name|reilly
284+
http://127.0.0.1:8080/search/publisher/?search=name:reilly
285285
286286
**Search for multiple terms**
287287

@@ -300,7 +300,7 @@ fields add multiple ``search`` query params and field names separated with
300300

301301
.. code-block:: text
302302
303-
http://127.0.0.1:8080/search/publisher/?search=name|reilly&search=city|london
303+
http://127.0.0.1:8080/search/publisher/?search=name:reilly&search=city:london
304304
305305
Filtering
306306
^^^^^^^^^
@@ -373,7 +373,7 @@ Filter documents by radius of 100000km from the given location.
373373

374374
.. code-block:: text
375375
376-
http://127.0.0.1:8000/search/publishers/?location__geo_distance=100000km|12.04|-63.93
376+
http://127.0.0.1:8000/search/publishers/?location__geo_distance=100000km__12.04__-63.93
377377
378378
Ordering
379379
^^^^^^^^
@@ -386,7 +386,7 @@ Filter documents by field ``city`` (ascending).
386386

387387
.. code-block:: text
388388
389-
http://127.0.0.1:8080/search/publisher/?search=country|armenia&ordering=city
389+
http://127.0.0.1:8080/search/publisher/?search=country:armenia&ordering=city
390390
391391
**Order documents by field (descending)**
392392

docs/changelog.rst

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,73 @@ 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.11
19+
----
20+
2018-07-15
21+
22+
.. note::
23+
24+
This release contains backwards incompatible changes.
25+
You should update your Django code and front-end parts of your applications
26+
that were relying on the complex queries using `|` and `:` chars in the
27+
GET params.
28+
29+
.. note::
30+
31+
If you have used custom filter backends using `SEPARATOR_LOOKUP_VALUE`
32+
`SEPARATOR_LOOKUP_COMPLEX_VALUE` or
33+
`SEPARATOR_LOOKUP_COMPLEX_MULTIPLE_VALUE` constants or
34+
`split_lookup_complex_value` helper method of the `FilterBackendMixin`,
35+
you most likely want to run your functional tests to see if everything
36+
still works.
37+
38+
.. note::
39+
40+
Do not keep things as they were in your own fork, since new search backends
41+
will use the `|` and `:` symbols differently.
42+
43+
**Examples of old API requests vs new API requests**
44+
45+
.. note::
46+
47+
Note, that `|` and `:` chars were mostly replaced with `__` and `,`.
48+
49+
*Old API requests*
50+
51+
.. code-block:: text
52+
53+
http://127.0.0.1:8080/search/publisher/?search=name|reilly&search=city|london
54+
http://127.0.0.1:8000/search/publishers/?location__geo_distance=100000km|12.04|-63.93
55+
http://localhost:8000/api/articles/?id__terms=1|2|3
56+
http://localhost:8000/api/users/?age__range=16|67|2.0
57+
http://localhost:8000/api/articles/?id__in=1|2|3
58+
http://localhost:8000/api/articles/?location__geo_polygon=40,-70|30,-80|20,-90|_name:myname|validation_method:IGNORE_MALFORMED
59+
60+
*New API requests*
61+
62+
.. code-block:: text
63+
64+
http://127.0.0.1:8080/search/publisher/?search=name:reilly&search=city:london
65+
http://127.0.0.1:8000/search/publishers/?location__geo_distance=100000km__12.04__-63.93
66+
http://localhost:8000/api/articles/?id__terms=1__2__3
67+
http://localhost:8000/api/users/?age__range=16__67__2.0
68+
http://localhost:8000/api/articles/?id__in=1__2__3
69+
http://localhost:8000/api/articles/?location__geo_polygon=40,-70__30,-80__20,-90___name,myname__validation_method,IGNORE_MALFORMED
70+
71+
- `SEPARATOR_LOOKUP_VALUE` has been removed. Use
72+
`SEPARATOR_LOOKUP_COMPLEX_VALUE` and
73+
`SEPARATOR_LOOKUP_COMPLEX_MULTIPLE_VALUE` instead.
74+
- `SEPARATOR_LOOKUP_NAME` has been added.
75+
- The method `split_lookup_complex_value` has been removed. Use
76+
`split_lookup_complex_value` instead.
77+
- Default filter lookup option is added. In past, if no specific lookup was
78+
provided and there were multiple values for a single field to filter on, by
79+
default `terms` filter was used. The `term` lookup was used by default
80+
in similar situation for a single value to filter on. It's now possible to
81+
declare default lookup which will be used when no lookup is given.
82+
- Removed deprecated `views` module. Import from `viewsets` instead.
83+
- Removed undocumented `get_count` helper from `helpers` module.
84+
1885
0.10
1986
----
2087
2018-07-06

0 commit comments

Comments
 (0)