mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-04 21:44:44 +00:00
Added basic useage docs for python developers
This commit is contained in:
parent
cb556c9ede
commit
4748684390
1 changed files with 21 additions and 0 deletions
|
|
@ -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
|
||||
=====================
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue