pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedtsearch2 and wildcards/pattern matching?
3+ messages / 2 participants
[nested] [flat]
* tsearch2 and wildcards/pattern matching?
@ 2010-07-07 20:41 Peter Koczan <pjkoczan@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Peter Koczan @ 2010-07-07 20:41 UTC (permalink / raw)
To: pgsql-sql
Hi all,
Is there any sort of pattern matching or partial matching capability
in tsearch2?
I'd like to be able search for a common prefix (like for order
numbers). For instance, tsearch2 will index 'zvt123456' or
'zvt555555', but I'd like to be able to find both of them in one query
using something akin to 'zvt%', like
select * from attachments where textsearchable @@ 'zvt%';
I've been unable to find anything in documentation. If there's
anything in tsearch2 that can do this and is faster than LIKE clauses
on full-text, that would be fantastic.
Cheers,
Peter
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: tsearch2 and wildcards/pattern matching?
@ 2010-07-07 22:44 Oleg Bartunov <oleg@sai.msu.su>
parent: Peter Koczan <pjkoczan@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Oleg Bartunov @ 2010-07-07 22:44 UTC (permalink / raw)
To: Peter Koczan <pjkoczan@gmail.com>; +Cc: pgsql-sql
it's called prefix search:
=# select 'zvt123456'::tsvector @@ 'zvt:*';
?column?
----------
t
On Wed, 7 Jul 2010, Peter Koczan wrote:
> Hi all,
>
> Is there any sort of pattern matching or partial matching capability
> in tsearch2?
>
> I'd like to be able search for a common prefix (like for order
> numbers). For instance, tsearch2 will index 'zvt123456' or
> 'zvt555555', but I'd like to be able to find both of them in one query
> using something akin to 'zvt%', like
>
> select * from attachments where textsearchable @@ 'zvt%';
>
> I've been unable to find anything in documentation. If there's
> anything in tsearch2 that can do this and is faster than LIKE clauses
> on full-text, that would be fantastic.
>
> Cheers,
> Peter
>
>
Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: tsearch2 and wildcards/pattern matching?
@ 2010-07-08 01:51 Peter Koczan <pjkoczan@gmail.com>
parent: Oleg Bartunov <oleg@sai.msu.su>
0 siblings, 0 replies; 3+ messages in thread
From: Peter Koczan @ 2010-07-08 01:51 UTC (permalink / raw)
To: Oleg Bartunov <oleg@sai.msu.su>; +Cc: pgsql-sql
On Wed, Jul 7, 2010 at 5:44 PM, Oleg Bartunov <oleg@sai.msu.su> wrote:
> it's called prefix search:
>
> =# select 'zvt123456'::tsvector @@ 'zvt:*';
> ?column? ----------
> t
Ah, that works. Excellent.
Thanks,
Peter
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2010-07-08 01:51 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-07-07 20:41 tsearch2 and wildcards/pattern matching? Peter Koczan <pjkoczan@gmail.com>
2010-07-07 22:44 ` Oleg Bartunov <oleg@sai.msu.su>
2010-07-08 01:51 ` Peter Koczan <pjkoczan@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