Opened 8 months ago

Last modified 7 months ago

#28041 assigned New feature

Postgres prefix searching for full text search

Reported by: Joe Tsoi Owned by: Joe Tsoi
Component: contrib.postgres Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

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 Lexemes 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))

Change History (5)

comment:1 Changed 8 months ago by Joe Tsoi

Owner: changed from nobody to Joe Tsoi
Status: newassigned

comment:2 Changed 8 months ago by Joe Tsoi

Component: Uncategorizedcontrib.postgres
Type: UncategorizedNew feature

comment:3 Changed 8 months ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:4 Changed 8 months ago by Joe Tsoi

Has patch: set

comment:5 Changed 7 months ago by Tim Graham

Needs documentation: set
Needs tests: set
Note: See TracTickets for help on using tickets.
Back to Top