Skip to content

Commit 904d7ad

Browse files
prepare 0.14
1 parent 3df4a1d commit 904d7ad

File tree

12 files changed

+173
-114
lines changed

12 files changed

+173
-114
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ 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.14.2
19-
------
20-
yyyy-mm-dd (not yet released)
18+
0.14
19+
----
20+
2018-08-06
2121

22-
- More like this detail view.
22+
- More like this support through detail action.
2323

2424
0.13.2
2525
------

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Main features and highlights
7171
- :doc:`Ids filter backend <advanced_usage_examples>`.
7272
- :doc:`Multi match search filter backend <search_backends>`.
7373
- :doc:`Simple search query search filter backend <search_backends>`.
74+
- :doc:`More-like-this support (detail action) <more_like_this>`.
7475

7576
Installation
7677
============

docs/changelog.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ 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.14.2
19-
------
20-
yyyy-mm-dd (not yet released)
18+
0.14
19+
----
20+
2018-08-06
2121

22-
- More like this detail view.
22+
- More like this support through detail action.
2323

2424
0.13.2
2525
------

docs/documentation.rst.distrib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Contents:
1616
basic_usage_examples
1717
advanced_usage_examples
1818
nested_fields_usage_examples
19-
misc_usage_examples
19+
more_like_this
2020
changelog
2121
django_elasticsearch_dsl_drf
2222

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Main features and highlights
7171
- :doc:`Ids filter backend <advanced_usage_examples>`.
7272
- :doc:`Multi match search filter backend <search_backends>`.
7373
- :doc:`Simple search query search filter backend <search_backends>`.
74+
- :doc:`More-like-this support (detail action) <more_like_this>`.
7475

7576
Installation
7677
============
@@ -223,7 +224,7 @@ Contents:
223224
basic_usage_examples
224225
advanced_usage_examples
225226
nested_fields_usage_examples
226-
misc_usage_examples
227+
more_like_this
227228
changelog
228229
django_elasticsearch_dsl_drf
229230

docs/misc_usage_examples.rst

Lines changed: 0 additions & 40 deletions
This file was deleted.

docs/more_like_this.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
==============
2+
More like this
3+
==============
4+
More like this functionality.
5+
6+
Usage example
7+
=============
8+
9+
Sample view
10+
-----------
11+
12+
.. code-block:: python
13+
14+
from django_elasticsearch_dsl_drf.filter_backends import (
15+
FilteringFilterBackend,
16+
IdsFilterBackend,
17+
OrderingFilterBackend,
18+
PostFilterFilteringFilterBackend,
19+
SearchFilterBackend,
20+
)
21+
from django_elasticsearch_dsl_drf.viewsets import (
22+
DocumentViewSet,
23+
MoreLikeThisMixin,
24+
)
25+
26+
class BookMoreLikeThisDocumentViewSet(DocumentViewSet,
27+
MoreLikeThisMixin):
28+
"""Same as BookDocumentViewSet, with more-like-this and no facets."""
29+
30+
filter_backends = [
31+
# ...
32+
FilteringFilterBackend,
33+
PostFilterFilteringFilterBackend,
34+
IdsFilterBackend,
35+
OrderingFilterBackend,
36+
SearchFilterBackend,
37+
# ...
38+
]
39+
40+
# More-like-this options
41+
more_like_this_options = {
42+
'fields': (
43+
'title.mlt',
44+
'summary.mlt',
45+
'description.mlt',
46+
)
47+
}
48+
49+
Sample request
50+
--------------
51+
52+
.. code-block:: text
53+
54+
http://localhost:8000/search/books-more-like-this-no-options/1007587/more_like_this/
55+
56+
Generated query
57+
---------------
58+
59+
.. code-block:: javascript
60+
61+
{
62+
"query": {
63+
"more_like_this": {
64+
"fields": [
65+
"title.mlt",
66+
"summary.mlt",
67+
"description.mlt"
68+
],
69+
"like": {
70+
"_index": "book",
71+
"_id": "1007587",
72+
"_type": "book_document"
73+
}
74+
}
75+
},
76+
"from": 0,
77+
"size": 14,
78+
"sort": [
79+
"_score"
80+
]
81+
}
82+
83+
Options
84+
-------
85+
Pretty much `all more-like-this options
86+
<https://www.elastic.co/guide/en/elasticsearch/reference/5.5/query-dsl-mlt-query.html>`_
87+
available in Elasticsearch. You might be particularly interested in the
88+
following:
89+
90+
- min_term_freq
91+
- max_query_terms
92+
- unlike
93+
- stop_words

examples/simple/factories/books_book.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class BookChapter112Factory(BookChapterFactory):
261261

262262

263263
class BookNovelFactory(BookWithUniqueTitleFactory):
264-
"""Book novel factory - texts of Robert Shekley."""
264+
"""Book novel factory - texts of Robert Sheckley."""
265265

266266
@post_generation
267267
def tags(obj, created, extracted, **kwargs):
@@ -270,6 +270,6 @@ def tags(obj, created, extracted, **kwargs):
270270
# Create from 1 to 7 ``Tag`` objects.
271271
amount = random.randint(1, 7)
272272
tags = TagGenreFactory.create_batch(amount, **kwargs)
273-
tag = TagFactory(title='Shekley')
273+
tag = TagFactory(title='Sheckley')
274274
tags.append(tag)
275275
obj.tags.add(*tags)

scripts/prepare_docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ cat basic_usage_examples.rst > docs/basic_usage_examples.rst
88
cat advanced_usage_examples.rst > docs/advanced_usage_examples.rst
99
cat nested_fields_usage_examples.rst > docs/nested_fields_usage_examples.rst
1010
cat filtering_usage_examples.rst > docs/filtering_usage_examples.rst
11-
cat misc_usage_examples.rst > docs/misc_usage_examples.rst
11+
cat more_like_this.rst > docs/more_like_this.rst

setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import find_packages, setup
44

5-
version = '0.13.2'
5+
version = '0.14'
66

77
DOCS_TRANSFORMATIONS = (
88
(
@@ -111,7 +111,6 @@
111111
'advanced_usage_examples.html#ids-filter'
112112
'>`_'.format(version)
113113
),
114-
115114
(
116115
':doc:`Multi match search filter backend <search_backends>`',
117116
'`Multi match search filter backend <'
@@ -126,6 +125,13 @@
126125
'search_backends.html#simple-query-string-filter-backend'
127126
'>`_'.format(version)
128127
),
128+
(
129+
':doc:`More-like-this support (detail action) <more_like_this>`',
130+
'`More-like-this support (detail action) <'
131+
'http://django-elasticsearch-dsl-drf.readthedocs.io/en/{}/'
132+
'more_like_this.html'
133+
'>`_'.format(version)
134+
),
129135
)
130136

131137
try:

0 commit comments

Comments
 (0)