pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedFTS and tri-grams
3+ messages / 3 participants
[nested] [flat]
* FTS and tri-grams
@ 2021-01-05 21:26 Mark Phillips <mark.phillips@mophilly.com>
2021-01-05 22:05 ` Re: FTS and tri-grams Christophe Pettus <xof@thebuild.com>
2021-01-06 08:02 ` Re: FTS and tri-grams Artur Zakirov <zaartur@gmail.com>
0 siblings, 2 replies; 3+ messages in thread
From: Mark Phillips @ 2021-01-05 21:26 UTC (permalink / raw)
To: pgsql-general <pgsql-general@lists.postgresql.org>
Some years ago we implemented FTS. At the time, we also added a column with the tsvector data type. We assumed we needed that for FTS to work.
Later, we added tri-gram support. At the time, we assumed tri-gram complimented FTS.
More recently, we have run into a problem with replicating the tsvector column.
We now wonder if tri-gram alone can achieve a fast full text search result. If so, then we could the tsvector column be dropped?
1. Is FTS required for tri-gram to work?
2. Are these independent of each other?
3. Is tri-gram alone sufficient for a “full text search” feature?
Any thoughts, experiences or other thoughts greatly appreciated.
- Mark Phillips
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: FTS and tri-grams
2021-01-05 21:26 FTS and tri-grams Mark Phillips <mark.phillips@mophilly.com>
@ 2021-01-05 22:05 ` Christophe Pettus <xof@thebuild.com>
1 sibling, 0 replies; 3+ messages in thread
From: Christophe Pettus @ 2021-01-05 22:05 UTC (permalink / raw)
To: Mark Phillips <mark.phillips@mophilly.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>
> On Jan 5, 2021, at 13:26, Mark Phillips <mark.phillips@mophilly.com> wrote:
> 1. Is FTS required for tri-gram to work?
> 2. Are these independent of each other?
> 3. Is tri-gram alone sufficient for a “full text search” feature?
The answers are, kind of in order:
2. Yes.
1. No.
3. It depends on what you mean by "full text search."
Trigrams are mostly for fuzzy matching on a single or small number of words. There are things that the tsvector machinery can do that trigrams can't, such as proximity searches between words, prefix and stemmed searches, and things of that type. If you just want fuzzy searching on a small number of words, trigrams are probably fine; for more sophisticated kinds of searching, you want tsvector.
They're completely different sets of functionality in PostgreSQL.
--
-- Christophe Pettus
xof@thebuild.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: FTS and tri-grams
2021-01-05 21:26 FTS and tri-grams Mark Phillips <mark.phillips@mophilly.com>
@ 2021-01-06 08:02 ` Artur Zakirov <zaartur@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Artur Zakirov @ 2021-01-06 08:02 UTC (permalink / raw)
To: Mark Phillips <mark.phillips@mophilly.com>; +Cc: pgsql-general <pgsql-general@lists.postgresql.org>
On Tue, Jan 5, 2021 at 10:26 PM Mark Phillips
<mark.phillips@mophilly.com> wrote:
> We now wonder if tri-gram alone can achieve a fast full text search result. If so, then we could the tsvector column be dropped?
>
> 1. Is FTS required for tri-gram to work?
> 2. Are these independent of each other?
FTS and tri-gram are independent features. You can implement them
independently, but it might depend on your use case.
> 3. Is tri-gram alone sufficient for a “full text search” feature?
It isn't sufficient if you want exact and/or phrase search.
--
Artur
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-01-06 08:02 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 21:26 FTS and tri-grams Mark Phillips <mark.phillips@mophilly.com>
2021-01-05 22:05 ` Christophe Pettus <xof@thebuild.com>
2021-01-06 08:02 ` Artur Zakirov <zaartur@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox