Added basic useage docs for python developers

This commit is contained in:
Karl Hobley 2014-07-09 15:43:07 +01:00
parent cb556c9ede
commit 4748684390

View file

@ -7,6 +7,27 @@ Wagtailsearch: For python developers
====================================
Basic useage
============
All searches are performed on Django QuerySets:
.. code-block:: python
# Search future EventPages
>>> from wagtail.wagtailcore.models import EventPage
EventPage.objects.filter(date__gt=timezone.now()).search("Hello world!")
All methods of ``PageQuerySet`` are supported by wagtailsearch:
.. code-block:: python
# Search all live EventPages that are under the events index
>>> EventPage.objects.live().descendant_of(events_index).search("Hello")
[<EventPage: Event 1>, <EventPage: Event 2>]
Indexing extra fields
=====================