summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorIan Foote <python@ian.feete.org>2017-10-11 22:55:52 +0530
committerTim Graham <timograham@gmail.com>2018-06-29 17:00:28 -0400
commit38cada7c94f5f73d2d47a0a730ea5d71d266fa2c (patch)
treef7cfb69df62a07b0cda4b3c0d1c4a2f6ea5780bf /docs/ref
parentb4cba4ed625ce7c88675616b3bbb237c28a926d1 (diff)
Fixed #28077 -- Added support for PostgreSQL opclasses in Index.
Thanks Vinay Karanam for the initial patch.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/indexes.txt22
1 files changed, 21 insertions, 1 deletions
diff --git a/docs/ref/models/indexes.txt b/docs/ref/models/indexes.txt
index a78423bd36..e585a6f824 100644
--- a/docs/ref/models/indexes.txt
+++ b/docs/ref/models/indexes.txt
@@ -21,7 +21,7 @@ options`_.
``Index`` options
=================
-.. class:: Index(fields=(), name=None, db_tablespace=None)
+.. class:: Index(fields=(), name=None, db_tablespace=None, opclasses=())
Creates an index (B-Tree) in the database.
@@ -72,3 +72,23 @@ in the same tablespace as the table.
For a list of PostgreSQL-specific indexes, see
:mod:`django.contrib.postgres.indexes`.
+
+``opclasses``
+-------------
+
+.. attribute:: Index.opclasses
+
+.. versionadded:: 2.2
+
+The names of the `PostgreSQL operator classes
+<https://www.postgresql.org/docs/current/static/indexes-opclass.html>`_ to use for
+this index. If you require a custom operator class, you must provide one for
+each field in the index.
+
+For example, ``GinIndex(name='json_index', fields=['jsonfield'],
+opclasses=['jsonb_path_ops'])`` creates a gin index on ``jsonfield`` using
+``jsonb_path_ops``.
+
+``opclasses`` are ignored for databases besides PostgreSQL.
+
+:attr:`Index.name` is required when using ``opclasses``.