#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 Thomas Aglassinger):

 Replying to [comment:6 Mariusz Felisiak]:

 > We could clarify this with a small diff, e.g.: ...

 Yes, that would be a welcome improvement.

 > > 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"''.

 I found this too abstract to apply immediately and would have liked an
 example similar to the one included in the proposed patch. At least
 something like:

 {{{
     from django.contrib.postgres.search import SearchVectorField

     class Entry(models.Model):
         ...  # same data fields as before
         search_vector = models.SearchVectorField(null=True)

         class Meta:
             indexes = [GinIndex(fields=['search_vector']]
 }}}
 Yes, everything shown here is explained one way or the other in the
 paragraphs before but it took me a while to turn these general and
 abstract descriptions into the code above. Unlike all the other parts in
 this chapter, which have a concise and well written example for the
 concepts they explain.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33459#comment:7>
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.658ecacaff5fafb6bf2c32084dc59d76%40djangoproject.com.

Reply via email to