Opened 8 years ago
Last modified 3 months ago
#28041 assigned New feature
Postgres prefix searching for full text search
Reported by: | Joe Tsoi | Owned by: | Calvin Vu |
---|---|---|---|
Component: | contrib.postgres | Version: | 1.10 |
Severity: | Normal | Keywords: | |
Cc: | Calvin Vu | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | 18823, | ||
Description ¶
I've needed prefix matching in full text search. As in #27899, It would be nice to add a RawSearchQuery
, but also to have it accept a Lexeme
so your query might look something like
Dog.objects.annotate(search=SearchVector('name')).filter(search=RawSearchQuery(Lexeme('opt', prefix=True)))
and combine Lexeme
s together either ANDing, ORing instead of just letting the user specify the query as a postgres string (https://www.postgresql.org/docs/9.6/static/datatype-textsearch.html#DATATYPE-TSQUERY)
Dog.objects.annotate(search=SearchVector('name')).filter(search=RawSearchQuery(Lexeme('opt', prefix=True) + Lexeme('blah', invert=True))
According to the ticket's flags, the next step(s) to move this issue forward are:
- To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (10)
comment:1 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 8 years ago
Component: | Uncategorized → contrib.postgres |
---|---|
Type: | Uncategorized → New feature |
comment:3 by , 8 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 8 years ago
Has patch: | set |
---|
comment:5 by , 8 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
comment:6 by , 4 years ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Owner: | changed from | to
comment:7 by , 4 years ago
Patch needs improvement: | set |
---|
comment:8 by , 3 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:9 by , 3 months ago
Cc: | added |
---|
comment:10 by , 3 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
PR