summaryrefslogtreecommitdiff
path: root/docs/ref/contrib/postgres/search.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ref/contrib/postgres/search.txt')
-rw-r--r--docs/ref/contrib/postgres/search.txt28
1 files changed, 27 insertions, 1 deletions
diff --git a/docs/ref/contrib/postgres/search.txt b/docs/ref/contrib/postgres/search.txt
index 65d54cfd8d..f00bddbee4 100644
--- a/docs/ref/contrib/postgres/search.txt
+++ b/docs/ref/contrib/postgres/search.txt
@@ -118,7 +118,7 @@ See :ref:`postgresql-fts-search-configuration` for an explanation of the
``SearchRank``
==============
-.. class:: SearchRank(vector, query, weights=None)
+.. class:: SearchRank(vector, query, weights=None, normalization=None, cover_density=False)
So far, we've returned the results for which any match between the vector and
the query are possible. It's likely you may wish to order the results by some
@@ -137,6 +137,32 @@ order by relevancy::
See :ref:`postgresql-fts-weighting-queries` for an explanation of the
``weights`` parameter.
+Set the ``cover_density`` parameter to ``True`` to enable the cover density
+ranking, which means that the proximity of matching query terms is taken into
+account.
+
+Provide an integer to the ``normalization`` parameter to control rank
+normalization. This integer is a bit mask, so you can combine multiple
+behaviors::
+
+ >>> from django.db.models import Value
+ >>> Entry.objects.annotate(
+ ... rank=SearchRank(
+ ... vector,
+ ... query,
+ ... normalization=Value(2).bitor(Value(4)),
+ ... )
+ ... )
+
+The PostgreSQL documentation has more details about `different rank
+normalization options`_.
+
+.. _different rank normalization options: https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-RANKING
+
+.. versionadded:: 3.1
+
+ The ``normalization`` and ``cover_density`` parameters were added.
+
``SearchHeadline``
==================