Opened 15 months ago

Last modified 12 months ago

#27899 assigned New feature

Phrase search query for Postgres full text search

Reported by: Ilya Semenov Owned by: Andrii Soldatenko
Component: contrib.postgres Version: master
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


Postgres 9.6 now supports phrase search with ... @@ phraseto_tsquery('hello world'). It would be great if Django supported it natively.

Currently, hard-codes SQL lookup formatting:

class SearchQuery(SearchQueryCombinable, Value):
    def as_sql(self, compiler, connection):
            template = 'plainto_tsquery({}::regconfig, %s)'.format(config_sql)

I believe the lookup function should be taken from a class level variable instead, and two more classes should be introduced: PhraseSearchQuery using phraseto_tsquery, and RawSearchQuery using to_tsquery.

Change History (10)

comment:1 Changed 15 months ago by Simon Charette

Component: Uncategorizedcontrib.postgres
Triage Stage: UnreviewedAccepted
Version: 1.10master

comment:2 Changed 14 months ago by Andrii Soldatenko

I need also this feature in my project, I'm going to start working on PR.

comment:3 Changed 12 months ago by Andrii Soldatenko

Has patch: set

comment:4 Changed 12 months ago by Mads Jensen

Needs documentation: set
Patch needs improvement: set

Release notes and documentation needed.

comment:5 Changed 12 months ago by Andrii Soldatenko

Owner: changed from nobody to Andrii Soldatenko
Status: newassigned

comment:6 Changed 12 months ago by Andrii Soldatenko

Needs documentation: unset

Added docs and tests.

comment:7 Changed 12 months ago by Andrii Soldatenko

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:8 Changed 12 months ago by Tim Graham

Triage Stage: Ready for checkinAccepted

"Ready for checkin" is set by a patch reviewer, not the patch author (see Triaging tickets).

comment:9 Changed 12 months ago by Andrii Soldatenko

Sorry for that. Thanks for the link!

comment:10 Changed 12 months ago by François Freitag

Patch needs improvement: set
Note: See TracTickets for help on using tickets.
Back to Top