#29582: SearchVector doesn't support querying non-text fields
-------------------------------------+-------------------------------------
Reporter: mickaelmarin | Owner: nobody
Type: Bug | Status: closed
Component: contrib.postgres | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Andrew Brown):
Replying to [comment:2 Simon Charette]:
The non-obvious issue with this change is that you can't use the
`concat()` function in a Postgresql index, as you can't use functions not
marked as IMMUTABLE. Django makes a note of this in an
[https://docs.djangoproject.com/en/2.2/ref/models/indexes/#condition
unrelated part of the docs]. So it's not possible to create an index that
is usable by this new SearchVector. I'm guessing this is why the
Postgresql docs all use the `||` operator along with `COALESCE()` (see the
examples on: https://www.postgresql.org/docs/current/textsearch-
tables.html )
I suppose a new bug should be created, but I'm not sure if this is
fixable. Perhaps just update the docs on the
[https://docs.djangoproject.com/en/2.2/ref/contrib/postgres/search/#performance
postgresql search page] with some hints or suggestions on this limitation.
In particular, this sentence is no longer accurate:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/29582#comment:5>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.c2842e08d513099a3a0e6c0ef72d0986%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.