Opened 7 years ago

Last modified 21 months ago

#28041 new New feature

Postgres prefix searching for full text search

Reported by: Joe Tsoi Owned by:
Component: contrib.postgres Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
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 (8)

comment:1 by Joe Tsoi, 7 years ago

Owner: changed from nobody to Joe Tsoi
Status: newassigned

comment:2 by Joe Tsoi, 7 years ago

Component: Uncategorizedcontrib.postgres
Type: UncategorizedNew feature

comment:3 by Tim Graham, 7 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Joe Tsoi, 7 years ago

Has patch: set

comment:5 by Tim Graham, 7 years ago

Needs documentation: set
Needs tests: set

comment:6 by Jacob Walls, 3 years ago

Needs documentation: unset
Needs tests: unset
Owner: changed from Joe Tsoi to Karl Hobley

comment:7 by Mariusz Felisiak, 3 years ago

Patch needs improvement: set

comment:8 by Mariusz Felisiak, 21 months ago

Owner: Karl Hobley removed
Status: assignednew
Note: See TracTickets for help on using tickets.
Back to Top