2014-07-08 15:43:49 +02:00
.. _management_commands:
2014-06-30 14:34:37 +02:00
Management commands
===================
2014-07-08 15:43:49 +02:00
.. _publish_scheduled_pages:
2014-06-30 14:34:37 +02:00
publish_scheduled_pages
-----------------------
2016-11-28 02:30:44 +01:00
.. code-block :: console
$ ./manage.py publish_scheduled_pages
2014-06-30 14:34:37 +02:00
2018-01-11 17:54:15 +01:00
This command publishes, updates or unpublishes pages that have had these actions scheduled by an editor. We recommend running this command once an hour.
2014-06-30 14:34:37 +02:00
2014-07-08 15:43:49 +02:00
.. _fixtree:
2014-06-30 14:34:37 +02:00
fixtree
-------
2016-11-28 02:30:44 +01:00
.. code-block :: console
$ ./manage.py fixtree
2014-06-30 14:34:37 +02:00
This command scans for errors in your database and attempts to fix any issues it finds.
2014-07-08 15:43:49 +02:00
.. _move_pages:
2014-06-30 14:34:37 +02:00
move_pages
----------
2016-11-28 02:30:44 +01:00
.. code-block :: console
$ manage.py move_pages from to
2014-06-30 14:34:37 +02:00
2014-07-01 17:45:44 +02:00
This command moves a selection of pages from one section of the tree to another.
2014-06-30 14:34:37 +02:00
Options:
- **from**
2014-07-04 22:57:58 +02:00
This is the **id** of the page to move pages from. All descendants of this page will be moved to the destination. After the operation is complete, this page will have no children.
2014-06-30 14:34:37 +02:00
- **to**
2014-07-04 22:57:58 +02:00
This is the **id** of the page to move pages to.
2014-06-30 14:34:37 +02:00
2014-07-08 15:43:49 +02:00
.. _update_index:
2014-06-30 14:34:37 +02:00
update_index
------------
2016-11-28 02:30:44 +01:00
.. code-block :: console
$ ./manage.py update_index [--backend <backend name>]
2014-06-30 14:34:37 +02:00
2018-09-21 11:59:52 +02:00
This command rebuilds the search index from scratch. It is not required when using the database search backend (`` wagtail.search.backends.db `` ).
2014-06-30 14:34:37 +02:00
It is recommended to run this command once a week and at the following times:
2014-07-01 17:45:44 +02:00
- whenever any pages have been created through a script (after an import, for example)
- whenever any changes have been made to models or search configuration
2014-06-30 14:34:37 +02:00
2014-07-01 17:45:44 +02:00
The search may not return any results while this command is running, so avoid running it at peak times.
2014-06-30 14:34:37 +02:00
2014-07-08 15:43:49 +02:00
2014-09-18 11:37:09 +02:00
Specifying which backend to update
`` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ``
By default, `` update_index `` will rebuild all the search indexes listed in `` WAGTAILSEARCH_BACKENDS `` .
If you have multiple backends and would only like to update one of them, you can use the `` --backend `` option.
For example, to update just the default backend:
2016-11-28 02:30:44 +01:00
.. code-block :: console
2014-09-18 11:37:09 +02:00
2016-11-28 02:30:44 +01:00
$ python manage.py update_index --backend default
2014-09-18 11:37:09 +02:00
2018-03-12 19:39:27 +01:00
The `` --chunk_size `` option can be used to set the size of chunks that are indexed at a time. This defaults to
1000 but may need to be reduced for larger document sizes.
2014-09-18 11:37:09 +02:00
2016-03-21 19:41:43 +01:00
Indexing the schema only
`` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ``
You can prevent the `` update_index `` command from indexing any data by using the `` --schema-only `` option:
2016-11-28 02:30:44 +01:00
.. code-block :: console
2016-03-21 19:41:43 +01:00
2016-11-28 02:30:44 +01:00
$ python manage.py update_index --schema-only
2016-03-21 19:41:43 +01:00
2014-09-18 11:37:09 +02:00
2019-01-25 15:48:22 +01:00
.. _wagtail_update_index:
wagtail_update_index
--------------------
An alias for the `` update_index `` command that can be used when another installed package (such as `Haystack <http://haystacksearch.org/> `_ ) provides a command named `` update_index `` . In this case, the other package's entry in `` INSTALLED_APPS `` should appear above `` wagtail.search `` so that its `` update_index `` command takes precedence over Wagtail's.
2014-07-08 15:43:49 +02:00
.. _search_garbage_collect:
2014-06-30 14:34:37 +02:00
search_garbage_collect
----------------------
2016-11-28 02:30:44 +01:00
.. code-block :: console
$ ./manage.py search_garbage_collect
2014-06-30 14:34:37 +02:00
2016-06-03 19:20:35 +02:00
Wagtail keeps a log of search queries that are popular on your website. On high traffic websites, this log may get big and you may want to clean out old search queries. This command cleans out all search query logs that are more than one week old (or a number of days configurable through the :ref: `WAGTAILSEARCH_HITS_MAX_AGE <wagtailsearch_hits_max_age>` setting).