Opened 3 years ago

Last modified 3 years 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


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 (

Dog.objects.annotate(search=SearchVector('name')).filter(search=RawSearchQuery(Lexeme('opt', prefix=True) + Lexeme('blah', invert=True))

Change History (5)

comment:1 Changed 3 years ago by Joe Tsoi

Owner: changed from nobody to Joe Tsoi
Status: newassigned

comment:2 Changed 3 years ago by Joe Tsoi

Component: Uncategorizedcontrib.postgres
Type: UncategorizedNew feature

comment:3 Changed 3 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

comment:4 Changed 3 years ago by Joe Tsoi

Has patch: set

comment:5 Changed 3 years ago by Tim Graham

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