Skip to content

Commit 1db9632

Browse files
prepare 0.6
1 parent a2e41c7 commit 1db9632

File tree

12 files changed

+257
-17
lines changed

12 files changed

+257
-17
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ 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.6
19+
---
20+
2017-11-28
21+
22+
- Added highlight backend.
23+
- Added nested search functionality.
24+
1825
0.5.1
1926
-----
2027
2017-10-18

CREDITS.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ Contributors
3535
Thanks to the following people for their contributions:
3636

3737
- [Jean-David Fiquet](https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/commits?author=id13)
38-
for his valuable contributions to the ``geo-spatial`` features.
38+
for his valuable contributions to the ``geo-spatial`` features, ``highlight``
39+
backend, ``nested search`` and a number of other additions/fixes.

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Main features and highlights
4848
- :doc:`Geo-spatial ordering filter backend <advanced_usage_examples>` (the
4949
following filters implemented: ``geo_distance``).
5050
- :doc:`Faceted search filter backend <advanced_usage_examples>`.
51+
- :doc:`Highlight backend <advanced_usage_examples>`.
5152
- :doc:`Suggester filter backend <advanced_usage_examples>`.
5253
- :doc:`Pagination (Page number and limit/offset pagination) <advanced_usage_examples>`.
5354
- :doc:`Ids filter backend <advanced_usage_examples>`.

ROADMAP.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,11 @@ Roadmap
22
=======
33
Road-map/upcoming releases.
44

5-
0.6
6-
---
7-
yyyy-mm-dd (future)
8-
9-
- Improved geo-spatial search/filtering/ordering support.
10-
115
0.7
126
---
137
yyyy-mm-dd (future)
148

9+
- Improved geo-spatial search/filtering/ordering support.
1510
- All filters (mentioned in the ``constants`` module) implemented.
1611
- Aggregations (also for geo-spatial backends).
1712
- Awesome documentation.

advanced_usage_examples.rst

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,123 @@ Phrase
15071507
}
15081508
}
15091509
1510+
Highlighting
1511+
------------
1512+
Highlighters enable you to get highlighted snippets from one or more fields
1513+
in your search results so you can show users where the query matches are.
1514+
1515+
**ViewSet definition**
1516+
1517+
.. code-block:: python
1518+
1519+
from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet
1520+
from django_elasticsearch_dsl_drf.filter_backends import (
1521+
# ...
1522+
HighlightBackend,
1523+
)
1524+
1525+
from ..documents import BookDocument
1526+
from ..serializers import BookDocumentSimpleSerializer
1527+
1528+
1529+
class BookDocumentViewSet(BaseDocumentViewSet):
1530+
"""The BookDocument view."""
1531+
1532+
document = BookDocument
1533+
# serializer_class = BookDocumentSerializer
1534+
serializer_class = BookDocumentSimpleSerializer
1535+
lookup_field = 'id'
1536+
filter_backends = [
1537+
# ...
1538+
HighlightBackend,
1539+
]
1540+
1541+
# ...
1542+
1543+
# Define highlight fields
1544+
highlight_fields = {
1545+
'title': {
1546+
'enabled': True,
1547+
'options': {
1548+
'pre_tags': ["<b>"],
1549+
'post_tags': ["</b>"],
1550+
}
1551+
},
1552+
'summary': {
1553+
'options': {
1554+
'fragment_size': 50,
1555+
'number_of_fragments': 3
1556+
}
1557+
},
1558+
'description': {},
1559+
}
1560+
1561+
# ...
1562+
1563+
**Request**
1564+
1565+
.. code-block:: text
1566+
1567+
GET http://127.0.0.1:8000/search/books/?search=optimisation&highlight=title&highlight=summary
1568+
1569+
**Response**
1570+
1571+
.. code-block:: javascript
1572+
1573+
{
1574+
"count": 1,
1575+
"next": null,
1576+
"previous": null,
1577+
"facets": {
1578+
"_filter_publisher": {
1579+
"publisher": {
1580+
"buckets": [
1581+
{
1582+
"key": "GWW",
1583+
"doc_count": 1
1584+
}
1585+
],
1586+
"doc_count_error_upper_bound": 0,
1587+
"sum_other_doc_count": 0
1588+
},
1589+
"doc_count": 1
1590+
}
1591+
},
1592+
"results": [
1593+
{
1594+
"id": 999999,
1595+
"title": "Performance optimisation",
1596+
"description": null,
1597+
"summary": "Ad animi adipisci libero facilis iure totam
1598+
impedit. Facilis maiores quae qui magnam dolores.
1599+
Veritatis quia amet porro voluptates iure quod
1600+
impedit. Dolor voluptatibus maiores at libero
1601+
magnam.",
1602+
"authors": [
1603+
"Artur Barseghyan"
1604+
],
1605+
"publisher": "Self published",
1606+
"publication_date": "1981-04-29",
1607+
"state": "cancelled",
1608+
"isbn": "978-1-7372176-0-2",
1609+
"price": 40.51,
1610+
"pages": 162,
1611+
"stock_count": 30,
1612+
"tags": [
1613+
"Guide",
1614+
"Poetry",
1615+
"Fantasy"
1616+
],
1617+
"highlight": {
1618+
"title": [
1619+
"Performance <b>optimisation</b>"
1620+
]
1621+
},
1622+
"null_field": null
1623+
}
1624+
]
1625+
}
1626+
15101627
Pagination
15111628
----------
15121629

docs/advanced_usage_examples.rst

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,123 @@ Phrase
15071507
}
15081508
}
15091509
1510+
Highlighting
1511+
------------
1512+
Highlighters enable you to get highlighted snippets from one or more fields
1513+
in your search results so you can show users where the query matches are.
1514+
1515+
**ViewSet definition**
1516+
1517+
.. code-block:: python
1518+
1519+
from django_elasticsearch_dsl_drf.views import BaseDocumentViewSet
1520+
from django_elasticsearch_dsl_drf.filter_backends import (
1521+
# ...
1522+
HighlightBackend,
1523+
)
1524+
1525+
from ..documents import BookDocument
1526+
from ..serializers import BookDocumentSimpleSerializer
1527+
1528+
1529+
class BookDocumentViewSet(BaseDocumentViewSet):
1530+
"""The BookDocument view."""
1531+
1532+
document = BookDocument
1533+
# serializer_class = BookDocumentSerializer
1534+
serializer_class = BookDocumentSimpleSerializer
1535+
lookup_field = 'id'
1536+
filter_backends = [
1537+
# ...
1538+
HighlightBackend,
1539+
]
1540+
1541+
# ...
1542+
1543+
# Define highlight fields
1544+
highlight_fields = {
1545+
'title': {
1546+
'enabled': True,
1547+
'options': {
1548+
'pre_tags': ["<b>"],
1549+
'post_tags': ["</b>"],
1550+
}
1551+
},
1552+
'summary': {
1553+
'options': {
1554+
'fragment_size': 50,
1555+
'number_of_fragments': 3
1556+
}
1557+
},
1558+
'description': {},
1559+
}
1560+
1561+
# ...
1562+
1563+
**Request**
1564+
1565+
.. code-block:: text
1566+
1567+
GET http://127.0.0.1:8000/search/books/?search=optimisation&highlight=title&highlight=summary
1568+
1569+
**Response**
1570+
1571+
.. code-block:: javascript
1572+
1573+
{
1574+
"count": 1,
1575+
"next": null,
1576+
"previous": null,
1577+
"facets": {
1578+
"_filter_publisher": {
1579+
"publisher": {
1580+
"buckets": [
1581+
{
1582+
"key": "GWW",
1583+
"doc_count": 1
1584+
}
1585+
],
1586+
"doc_count_error_upper_bound": 0,
1587+
"sum_other_doc_count": 0
1588+
},
1589+
"doc_count": 1
1590+
}
1591+
},
1592+
"results": [
1593+
{
1594+
"id": 999999,
1595+
"title": "Performance optimisation",
1596+
"description": null,
1597+
"summary": "Ad animi adipisci libero facilis iure totam
1598+
impedit. Facilis maiores quae qui magnam dolores.
1599+
Veritatis quia amet porro voluptates iure quod
1600+
impedit. Dolor voluptatibus maiores at libero
1601+
magnam.",
1602+
"authors": [
1603+
"Artur Barseghyan"
1604+
],
1605+
"publisher": "Self published",
1606+
"publication_date": "1981-04-29",
1607+
"state": "cancelled",
1608+
"isbn": "978-1-7372176-0-2",
1609+
"price": 40.51,
1610+
"pages": 162,
1611+
"stock_count": 30,
1612+
"tags": [
1613+
"Guide",
1614+
"Poetry",
1615+
"Fantasy"
1616+
],
1617+
"highlight": {
1618+
"title": [
1619+
"Performance <b>optimisation</b>"
1620+
]
1621+
},
1622+
"null_field": null
1623+
}
1624+
]
1625+
}
1626+
15101627
Pagination
15111628
----------
15121629

docs/changelog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ 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.6
19+
---
20+
2017-11-28
21+
22+
- Added highlight backend.
23+
- Added nested search functionality.
24+
1825
0.5.1
1926
-----
2027
2017-10-18

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Main features and highlights
4848
- :doc:`Geo-spatial ordering filter backend <advanced_usage_examples>` (the
4949
following filters implemented: ``geo_distance``).
5050
- :doc:`Faceted search filter backend <advanced_usage_examples>`.
51+
- :doc:`Highlight backend <advanced_usage_examples>`.
5152
- :doc:`Suggester filter backend <advanced_usage_examples>`.
5253
- :doc:`Pagination (Page number and limit/offset pagination) <advanced_usage_examples>`.
5354
- :doc:`Ids filter backend <advanced_usage_examples>`.

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.5.1'
5+
version = '0.6'
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.5.1'
6+
__version__ = '0.6'
77
__author__ = 'Artur Barseghyan <[email protected]>'
88
__copyright__ = '2017 Artur Barseghyan'
99
__license__ = 'GPL 2.0/LGPL 2.1'

0 commit comments

Comments
 (0)