pull/1889/merge
Matt Westcott 2015-12-11 12:46:01 +00:00
rodzic 5982ed3905
commit 2c765a7462
3 zmienionych plików z 30 dodań i 0 usunięć

Wyświetl plik

@ -5,6 +5,7 @@ Changelog
~~~~~~~~~~~~~~~~
* Django 1.9 support
* Support for indexing fields across relations in Elasticsearch
* Added `WAGTAIL_PASSWORD_RESET_ENABLED` setting to allow password resets to be disabled independently of the password management interface (John Draper)
* Updated fonts for more comprehensive Unicode support
* Added `.alt` attribute to image renditions

Wyświetl plik

@ -16,6 +16,33 @@ Django 1.9 support
Wagtail is now compatible with Django 1.9.
Indexing fields across relations in Elasticsearch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fields on related objects can now be indexed in Elasticsearch using the new ``indexed.RelatedFields`` declaration type:
.. code-block:: python
class Book(models.Model, indexed.Indexed):
...
search_fields = [
indexed.SearchField('title'),
indexed.FilterField('published_date'),
indexed.RelatedFields('author', [
indexed.SearchField('name'),
indexed.FilterField('date_of_birth'),
]),
]
# Search books where their author was born after 1950
# Both the book title and the authors name will be searched
>>> Book.objects.filter(author__date_of_birth__gt=date(1950, 1, 1)).search("Hello")
See: :ref:`wagtailsearch_index_relatedfields`
Minor features
~~~~~~~~~~~~~~

Wyświetl plik

@ -111,6 +111,8 @@ Options
These are added to the search index but are not used for full-text searches. Instead, they allow you to run filters on your search results.
.. _wagtailsearch_index_relatedfields:
``index.RelatedFields``
-----------------------