#33459: Explain how to optimize full text search with SearchVectorField and
GinIndex
-------------------------------------+-------------------------------------
Reporter: Thomas Aglassinger | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 4.0
Severity: Normal | Resolution: wontfix
Keywords: postgres | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
> The difference with full text search is that you cannot use the standard
indexes but have to use the particular `GinIndex` or` GistIndex` only
provided by postgres.
We could clarify this with a small diff, e.g.:
{{{#!diff
diff --git a/docs/ref/contrib/postgres/search.txt
b/docs/ref/contrib/postgres/search.txt
index cfed877d9c..4304d47552 100644
--- a/docs/ref/contrib/postgres/search.txt
+++ b/docs/ref/contrib/postgres/search.txt
@@ -255,8 +255,10 @@ run into performance problems. Full text search is a
more intensive process
than comparing the size of an integer, for example.
In the event that all the fields you're querying on are contained within
one
-particular model, you can create a functional index which matches the
search
-vector you wish to use. The PostgreSQL documentation has details on
+particular model, you can create a functional
+:class:`GIN <django.contrib.postgres.indexes.GinIndex>` or
+:class:`GiST <django.contrib.postgres.indexes.GistIndex>` index which
matches
+the search vector you wish to use. The PostgreSQL documentation has
details on
`creating indexes for full text search
<https://www.postgresql.org/docs/current/textsearch-tables.html
#TEXTSEARCH-TABLES-INDEX>`_.
}}}
> Also there is no real point using them with the text fields of your
model, which I had intuitively assumed.
It's already documented in the
[https://docs.djangoproject.com/en/dev/ref/contrib/postgres/search/#performance
Performance] section: ''"can create a functional index which **matches the
search vector** you wish to use"''.
--
Ticket URL: <https://code.djangoproject.com/ticket/33459#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.18d5ffce8c8334d4096579a33c8145f3%40djangoproject.com.